Closed harvitronix closed 4 years ago
Issue-Label Bot is automatically applying the label feature_request
to this issue, with a confidence of 0.60. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
Sorry for the late response.
If you are using fetch or a fetch polyfill you can call: auth.authorizedRequest
with the same arguments you would use in fetch. This method is a wrapper around fetch that also adds the authorization header to each request.
If this doesn't seem to work with your workflow, let me know and I'll work something out.
@samuelgozi This worked great! Not sure how I missed that when browsing the code. Thank you. 👍
First of all, thank you so much for your work on this. It's a life safer.
I need to programmatically get the user's ID token, refreshed if it's expired. In the official SDK, I would use
const token = await user.getIdToken()
, and know that I would have a valid token. (For context, this is happening in a backgroundfetch()
call, so there's no re-render or other action happening that is triggeringemit()
before this call is made, so the token could be over an hour old, therefore expired.)I tried calling the
refreshIdToken()
method directly when the fetch is made, expecting it to update the state and then trigger the listener, which would update token manager's ID token. But it doesn't seem to update the token when I call it directly. If I refresh the page in my app, it refreshes the token as expected.Any ideas? Much appreciated. 🙏