I’m seeking guidance rather than a technical answer at this point. I am using the
@okta/okta-react package to create an auth flow. I can successfully login and logout no problems using the provided
logout methods. This successfully creates a token in the localStorage`.
However, my application performs GraphQL requests and I would like to implement a flow for refreshing and retrieving tokens if a GQL request is in flight and the current token has expired. I do not want to force users to logout at this point, but refresh the existing token, if that is possible.
I have been following the docs for
@okta/okta-auth-js, but am unclear as to which methods I should be using to refresh an existing token and retrieve a new/refreshed token, which will be used in my GQL requests.
There seem to be multiple paths, using
tokenManager, but I’m not clear on which way is correct.
Could anyone advise:
- Which method should I be using to access the exiting token in localStorage?
- Which method should I be using to refresh that token?
- How do I retrieve the new/refreshed token value
Am I going about this completely wrong?