-
Notifications
You must be signed in to change notification settings - Fork 83
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
How do I get the access token from a code I already have? #64
Comments
I changed this to use a site-specific redirect uri and now I'm getting:
This seems pretty common but none of the solutions I see are working for me. |
Hiya @cinjon I think you're running into a bug introduced in v0.4.0. Please use 0.3.0 until the fix is released in 0.4.1 |
I tried downgrading and am still getting the same error:
|
Is there a way to get more visibility into what is the error? All I'm seeing is (@cc @busunkim96 ) |
Hmm, can verify that the desired redirect_uri is in the |
So that was an issue, and I've now updated it - and I still get the same error. Fwiw, this is all happening in local development. My current credentials.json looks like: As you can see, I have inserted all the things I could think of to try and get it to not be a mismatch. I've also tried the redirect_uri combinations in my local JS as well. Do you have more suggestions? That last one was really useful. Thanks! |
@cinjon Did you edit the file manually? If so, you should go to the API console and edit your existing OAuth client ID. After that you can re-download the credentials. |
I didn't. I downloaded it from the console. |
It looks like the library you linked is using gapi under the hood. You might want to take a look at that documentation as well. https://developers.google.com/identity/sign-in/web/reference#gapiauth2clientconfig There are some more general suggestions in this stackoverflow post. |
When you do figure out the solution, would you mind posting back here? It will help who stumbles on this issue in the future. 😃 |
This happened to me after trying to use the OAuth2 authorization code more then once. The solution for me was to get a fresh authorization code. |
I am also getting the same error with version 0.4.2 |
Revisiting this, I think @Andras1000 is correct. To get a new access token you need to use the refresh token. Documentation: |
@busunkim96 How do i get the refresh token tho? I have got the authorization code from the front end and want to store the refresh token in my django backend. |
@Chokerino The authorization code should be exchanged for a refresh token. https://developers.google.com/identity/protocols/oauth2/web-server#exchange-authorization-code |
I used ReactGoogleLogin (https://github.com/anthonyjgrove/react-google-login) to get the offline
code
. This works fine and is associated with my clientId. I then want to have the server complete the process with this API.Doing the following does not work and yields an error
oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant) code_verifier or verifier is not needed.
. How do I fix this?Note that I tried this w/ and w/o the redirect_uri. I also tried it with the redirect_uri for my website. All gave the same error.
The text was updated successfully, but these errors were encountered: