-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 Grant Error when using OAuth2Client set with tokens from Firebase Google Auth to make gmail requests #2353
Comments
I've realised the issue, the refresh token firebase provided along with the access_token has nothing to do with google but rather its own use to maintain the user's auth status in relation to firebase. So the real question here is how do I use my one time access token and id token upon initial authorization and authentication to get a google refresh token so I can continue to make authorized api calls? |
Hi @ShehabSN , thank you for the detailed bug report. Unfortunately, this issue tracker has limited visibility and scope - basically, it's just for reporting issues with the samples contained here and is only watched by the folks who work on these samples. We are happy to help you move this bug to venues where it'll get the attention of the appropriate product teams.
I'm going to close this issue because the folks who own this repo have no actionable way to resolve it directly, but please let us know if there's anything we can do to help! |
@fhinkel i just experienced this now using the Here is a copy of the error log without the tokens:
|
It works now. I guess the Calendar API went down for few seconds |
Any luck? are you able to do that?? |
So my application uses firebase and so I've utilized Firebase's Google Auth implementation as it is very simple and firebase handles all the background work like persistence and what not. However, I plan on getting permission from the users to access their gmail and read or send emails using the
https://www.googleapis.com/auth/gmail.modify
scope and Firebase Cloud Functions. I've been able to successfully authenticate with Firebase with the given scopes. Upon login I get a lot of data back, including an access token, id token, refresh token, and the users google info like google id etc, as well as a lot of highly obfuscated fields. So I am assuming that what happened is Firebase handles the initial part of the authentication where they get back an authorization code and then get back an access token and id token as well as referesh token which I get access to.With that being said, I figured I would be able to use the access and refresh tokens as well as the user's google id to make api calls to modify the emails. So this is the code that I have tested out on a node.js server.
When I go to the google developer console, I notice for my firebase email, an OAuth client and service account have been autogenerated by firebase which i think is expected.
When I run this code, I get an Invalid grant error. I have traced the code, it is failing when I try to get the user messages. I am not sure what is causing this? I thought perhaps google's default auth access_type was online so I made sure to set custom parameters and set it to offline so that's not the issue. These are the logs when i run this:
Any ideas?
The text was updated successfully, but these errors were encountered: