Currently, there is a case when the access token is null and getSession method fails with null reference exception.
We check idToken for null here if (await storage.getItem(idTokenKey) != null) { but we don't check accessToken for null which causes an exception inside CognitoJwtToken constructor (it calls decodePayload which forces unwrapping token value what is null)
So, the idea is
Check that access token exists as well as idToken
Try to refresh session in case either ID or Access token is null, but refresh token exists
Currently, there is a case when the access token is null and
getSession
method fails with null reference exception.We check idToken for null here
if (await storage.getItem(idTokenKey) != null) {
but we don't check accessToken for null which causes an exception insideCognitoJwtToken
constructor (it calls decodePayload which forces unwrapping token value what is null)So, the idea is