Problem with connect 3.3.5 (Missing required parameter: scope)
See original GitHub issueI had a working app with passport-google-oauth v0.1.5
and passport v0.1.16
on node v0.8
with connect v2.27.1
. The issue appeared since I updated to connect v3.3.5
on node v0.10.38
and passport-google-oauth v0.2.0
and passport v0.2.1
.
The first request looks OK to me.
https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&user_id=testaccount%40gmail.com&response_type=code&redirect_uri=http%3A%2F%2Fapp.testapp.com%3A5000%2Foauth2%2Fcallback&scope=profile%20email&client_id=XXXXXXXX.apps.googleusercontent.com
After click the Accept
button at the permission page I see this problem.
400. That’s an error.
Error: invalid_request
Missing required parameter: scope
Request Details
response_type=code
redirect_uri=http://app.testapp.com:5000/oauth2/callback
client_id=XXXXXXXX.apps.googleusercontent.com
That’s all we know.
Here are the details, how I set up.
passport.use new GoogleStrategy(
clientID: process.env.GOOGLE_CLIENT_ID || conf.GOOGLE_CLIENT_ID
clientSecret: process.env.GOOGLE_CLIENT_SECRET || conf.GOOGLE_CLIENT_SECRET
callbackURL: "https://" + process.env.HOST) + "/oauth2/callback"
passReqToCallback: true
, (req, accessToken, refreshToken, profile, done) ->
server = connect()
.use(cookieParser())
.use(bodyParser.json())
.use(bodyParser.urlencoded({extended: true}))
.use(session(
store: new RedisStore(
pass: getRedisParams().pass
host: getRedisParams().host
port: getRedisParams().port
ttl: 3600 #one hour
)
secret: "XXXXXXXX"
saveUninitialized: true
resave: true
cookie:
domain: process.env.HOST || conf.HOST
maxAge: 604800000
))
.use(passport.initialize())
.use(passport.session())
.use(connectRoute(routes))
(passport.authenticate('google',
scope: [
'profile'
'email'
]
accessType: 'offline'
userID: email
approvalPrompt: 'force'
)) req, res, next
(passport.authenticate('google',
failureRedirect: '/oauth2/failed'
successRedirect: '/oauth2/success'
)) req, res, next
Issue Analytics
- State:
- Created 8 years ago
- Comments:6
Top Results From Across the Web
Error 400: invalid_request Missing required parameter: scope
Hello! Well, seems that, during the HTTP requests and redirects, for some reason, the HTTP request that should contain the scope GET parameter...
Read more >Missing required parameter: scope | Error Resolved - YouTube
Missing required parameter : scope | Error Resolved |Google Oauth. Watch later. Share. Copy link. Info. Shopping. Tap to unmute.
Read more >Missing required parameter: scope when using ...
I'm successfully generating $authorizationUrl using the code below. However on using that URL I'm receiving the error: Missing required parameter: scope.
Read more >RFC 4960: Stream Control Transmission Protocol
Recommended Transmission Control Block (TCB) Parameters ......129 13.1. ... but the SCTP association is a broader concept than the TCP connection.
Read more >Creating and Configuring an Oracle Database
You must use the advanced configuration mode of DBCA or the CREATE DATABASE statement to select a non-recommended character set. If no character...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For anyone who gets the scope problem, pass it to Passport params like this: (it works perfect for me)
` new GoogleStrategy({ clientID: global.config.passport.google.clientID,
Just in case this helps anyone coming from google, I was having this error when doing:
I guess the call to
passport.authenticate()
has to be directly in the express route’s callback chain:That’s working for me now.