Skip to content

Impossibile to refresh token when access token is expired #194

@metalsho

Description

@metalsho

Hi everyone,

I need to make an App with and "everlasting" session.
I can refresh the token (refreshToken) if the App is open and the token is not expired. But if I close the app, and the token expires, when I open the app (or the angular website) every call to auth fails:

  • isAuthenticated$: return false;
  • getValidToken (with or without the buffer): return error
  • loadTokenFromStorage: do nothing
  • refreshToken: do nothing

I tried to change the order of those calls, and wait the result every one of them before try the next, but the results are the same.

I'm waiting for both ready-state of platform and auth service, but it seems that it's impossibile to read the stored token.
I tried even to change the store module. I switched to the IonicStorage (indexedDB on the web, as example) so I am sure that is not a problem related to the volatile nature of the localStorage.

The "funny" part is that I can acktually manage to refresh the session ( and obtain a valid Access Token) if I make the call to the okta endpoint by myself using the httpClient. I tried to "revive" the auth service overwriting the stored response token with the new one, but It seems to be useless: the ionic-appauth service cannot retrieve any valid token anymore.

Can you please give me an example of a working "everlasting" session setup?

Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions