Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It seems that there is no token specified for user #102

Open
victoriaunizhona opened this issue Apr 14, 2021 · 1 comment
Open

It seems that there is no token specified for user #102

victoriaunizhona opened this issue Apr 14, 2021 · 1 comment

Comments

@victoriaunizhona
Copy link

victoriaunizhona commented Apr 14, 2021

Describe the bug
I want to auth with Firebase and then use token - to store and retrieve data from firebase for authenticated users.
It seems that user object does not contain token.

To Reproduce
Steps to reproduce the behavior:

  1. Auth via Google or Email-password
  2. Check user object returned
  3. There is no token

Expected behavior
Token property is shown there

There is a workaround - to useEffect() for user change. Then add property to the user with
firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idToken) {
// Send token to your backend via HTTPS
// ...
}).catch(function(error) {
// Handle error
});

@armand1m
Copy link
Owner

armand1m commented Jul 4, 2021

Hey! In this example you can see the user data that is provided: https://armand1m.github.io/react-with-firebase-auth/

If you create an account it'll log in immediately and show you the tokens that come with the user data, which is just a stringified version of the user property that is passed to the wrapped component

I assume you want to access the user.stsTokenManager.accessToken

let me know if this is what you're looking for; otherwise, we can try to provide tokens through the props.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants