Skip to content

Passing token in the headers #55

Answered by tlays
ZouTiger asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @ZouTiger , I believe this is the example that you are looking for: https://github.com/gladly-team/next-firebase-auth/blob/main/example/pages/static-auth-required-loader.js

  1. Make sure that page is wrapped with withAuthUser HOC
  2. Then const AuthUser = useAuthUser() to retrieve the instance of the currently logged in user
  3. const token = await AuthUser.getIdToken() to retrieve auth token
  4. And then you can call your external API with the headers properly set as done here

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ZouTiger
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants