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

InternalOAuthError "message": "failed to obtained request token" #127

Open
leofisG opened this issue Aug 2, 2017 · 2 comments
Open

InternalOAuthError "message": "failed to obtained request token" #127

leofisG opened this issue Aug 2, 2017 · 2 comments

Comments

@leofisG
Copy link

leofisG commented Aug 2, 2017

I am using the passport-google-oauth library and I am trying to get the user's email after user consent. I have created an endpoint /api/v1/auth/google for the user to authorize my application. But now I encountered this InternalOAuthError.

After console.log the error message I got the following:

  name: 'InternalOAuthError',
  message: 'Failed to obtain request token',
  oauthError:
   { statusCode: 307,
     data: '<HTML>\n<HEAD>\n<TITLE>Temporary Redirect</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Temporary Redirect</H1>\nThe document has moved <A HREF="https://accounts.google.com/OAuthGetRequestToken">here</A>.\n</BODY>\n</HTML>\n' } }

I wrote my code with reference to this example. But if people want to see the code I can paste it here.

Thanks in advance for the help.

@AhmadIbrahiim
Copy link

Any updates on this. I'm getting this error back again.


 name: 'InternalOAuthError',
  message: 'Failed to obtain request token',
  oauthError:
   { statusCode: 307,
     data:
      '<HTML>\n<HEAD>\n<TITLE>Temporary Redirect</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Temporary Redirect</H1>\nThe document has moved <A HREF="https://accounts.google.com/OAuthGetRequestToken">here</A>.\n</BODY>\n</HTML>\n' } }

@kfrajtak
Copy link

kfrajtak commented Mar 15, 2020

I am getting the same error. In the debugging session I can see that this response is received when posting data POST /accounts/OAuthGetRequestToken HTTP/1.1.

I looked up the location where that URL is used and looks like I can change it in options:

passport.use(
  new GoogleStrategy(
    {
      consumerKey: process.env.REACT_APP_GOOGLE_CONSUMER_KEY,
      consumerSecret: process.env.GOOGLE_CONSUMER_SECRET,
      followRedirects: true,
      requestTokenURL: "https://accounts.google.com/OAuthGetRequestToken",
      callbackURL: "http://localhost:3000/api/auth/google/callback"
    },
    function(token, tokenSecret, profile, done) {
      User.findOrCreate({ googleId: profile.id }, function(err, user) {
        return done(err, user);
      });
    }
  )
);

Unfortuntely, that results in 400 - not found...

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

3 participants