I am currently integration Auth0 using the new spa sdk. The issue I am facing is, that retrieving the access token is an async operation using this flow. So basically, before every request, I would need to retrieve the token.
Vue Apollo on the other hand only allows to set up the token synchronously. I have already checked, if there is an easy way to make the Apollo Client to accept a promise for the authorization header, but that does not seem to be the case.
What is the best way to tackle this issue?
What I have tried is to setup a watcher for isAuthenticated, retrieve the token and set it into local storage. However as far as I understand, this is not how it is meant, as the token has to be fetched before every request. Also that results in a race condition, as the query in the component might be fired, before the token is retrieved.
Is there a way to use the PKCE flow in my case, or do I have to revert to the implicit flow?
Thank you for your help!