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

Invalid custom tokens while using Google authentification #90

Closed
SaeedHK opened this issue Feb 22, 2021 · 4 comments
Closed

Invalid custom tokens while using Google authentification #90

SaeedHK opened this issue Feb 22, 2021 · 4 comments
Labels
question Further information is requested

Comments

@SaeedHK
Copy link

SaeedHK commented Feb 22, 2021

Describe the bug

I would like to add Google authentication to the example you provided in the repository. Specifically, I modified signInOptions in example/components/FirebaseAuth.js as follows:

  signInOptions: [
    firebase.auth.GoogleAuthProvider.PROVIDER_ID,
  ],

Setting up my firebase config info, when I try to login I get the following error:

Error: Problem getting a refresh token: {"error":{"code":400,"message":"INVALID_CUSTOM_TOKEN","errors":[{"message":"INVALID_CUSTOM_TOKEN","domain":"global","reason":"invalid"}]}}

I checked the token in https://jwt.io/ and it also raised that the token is invalid.

Version

0.13.0-alpha.0

@qvanderlinden
Copy link

Hi, I am facing the same issue when running the repo example. The error occurs when setAuthCookies is called on the pages/api/login endpoint. Also using version 0.13.0-alpha.0

@SaeedHK SaeedHK changed the title Invalid costum tokens while using Google authentification Invalid custom tokens while using Google authentification Feb 22, 2021
@kmjennison
Copy link
Contributor

Some people have run into this problem because the Firebase email address was incorrect. Can you double-check your Firebase config?

Other people seem to run into this when their server time is incorrect.

I checked the token in https://jwt.io/ and it also raised that the token is invalid.

@SaeedHK If it's invalid, what is wrong with it?

I'll help where I can, though I unfortunately don't have much time to help investigate particular implementation problems.

@SaeedHK
Copy link
Author

SaeedHK commented Mar 1, 2021

Thank you @kmjennison for your reply. You''re right, I made a mistake on the Firebase client email. Using the correct one, solved the problem.

@SaeedHK SaeedHK closed this as completed Mar 1, 2021
@kmjennison kmjennison added the question Further information is requested label Mar 1, 2021
@rooprob
Copy link

rooprob commented Mar 3, 2021

To note, the correct FIREBASE_CLIENT_EMAIL is the Google Cloud IAM Service Account email that matches up with the FIREBASE_PRIVATE_KEY.

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

No branches or pull requests

4 participants