passport-google-oauth2
passport-google-oauth2 copied to clipboard
Getting a Error 400
I'm getting a error 400 from google
Error: invalid_request Missing required parameter: scope
Looks like the library does not send the scope parameter. Is there anyway to set it?
app.get('/auth/google',
passport.authenticate('google', { scope: scope }),
function(req, res) {
/* do nothing as this request will be redirected to google for authentication */
}
);
I'm getting this same error, and I can't find answers anywhere. I'm passing the desired scope to passport.authenticate(), as described by @toadkicker. Here is the line in my app:
api.get('/auth/google', passport.authenticate('google', { scope: auth.google.scope }));
If I change the desired scope, it is reflected on the deny/allow page, so it seems the scope is being sent. The error shows up after Allow is selected.
Any help would be greatly appreciated.
Figured I should add the return route also.
api.get('/auth/google/return', passport.authenticate('google', { failureRedirect: '/hello/fail', successRedirect: '/hello/succeed' });
Seems this is actually where the error is occurring. If I comment out that line, the request comes back from Google to '/auth/google/return'. So, is Passport redirecting back to the Google error page?
Forgot to come back here. Seems it was an issue with the way I was setting up my Restify server. I was able to fix this by adding the following code after initializing the server:
api.use(restify.plugins.queryParser({ mapParams: false }));
Once I added that line, I no longer saw the Google error, and the process passed back to my code.