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

Oauth2.refreshAccessToken returns invalid_request #111

Closed
0xmtn opened this issue Dec 26, 2016 · 2 comments
Closed

Oauth2.refreshAccessToken returns invalid_request #111

0xmtn opened this issue Dec 26, 2016 · 2 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@0xmtn
Copy link

0xmtn commented Dec 26, 2016

I'm having issues when I try to use "refreshAccessToken" function: invalid_request. So after so many hours wasted on this I tried to use the private "refreshToken_" function, which returned the main reason why it is an invalid request: Could not determine client ID from request.

Here is the code I'm trying:

    var auth = new google_auth();   
    var oauth2Client = new auth.OAuth2(conf.cliend_id, conf.client_secret, conf.red_url);
    var creds = {access_token: accessToken,  // **I tried without this too**
                refresh_token: refreshToken};
    oauth2Client.setCredentials(creds);
    oauth2Client.refreshAccessToken(function(err, tokens){
      console.log("ERR: ", err); // keeps saying invalid_request 400 and nothing more 
      console.log("TOKENS: ", tokens); // NULL

Couldn't find a solution, so I tried this:

    var auth = new google_auth();   
    var oauth2Client = new auth.OAuth2(conf.cliend_id, conf.client_secret, conf.red_url);
    var creds = {access_token: accessToken,  // **I tried without this too**
                refresh_token: refreshToken};
    oauth2Client.setCredentials(creds); // Tried without this too
    oauth2Client.refreshToken_(refreshToken, function(err, tokens, response){
      console.log("ERR: ", err); // keeps saying invalid_request 400 and nothing more.
      console.log("RESPONSE: ", response); //bunch of stuff here, also where I found the reason for the error
      console.log("TOKENS: ", tokens); // NULL

I am on server side using google-auth-library and googleapis.

How can I solve this? Is this a problem on my side or is there anything else I should know about this APIs?

@ianmetcalf
Copy link
Contributor

Not sure if the above code was copied verbatim or not, but you have a typo conf.cliend_id instead of conf.client_id. Again I'm not sure if this is just mis-copied, and I don't know anything about where your setting the conf object, but probably worth a double check.

@JustinBeckwith
Copy link
Contributor

Fixed in #215

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 6, 2020
@JustinBeckwith JustinBeckwith self-assigned this Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

5 participants