-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Not able to get the _id to insert authorization code. I have tried many things. I suspect bodyparser but not sure what to look at next. Thank You for all of your Hard Work!
The Code
server.grant(oauth2orize.grant.code(function(client, redirectURI, user, ares, done) {
console.log(client, redirectURI, user, ares)
This Console.Log Will Report This:
[ { _id: 54406b28caec9a9d51c86e1c,
name: 'REDACTED',
clientId: 'EUubHaOj',
clientSecret: 'xiP6Zgwk0vGj5Jad24xV' } ] 'http://www.REDACTED.net' { _id: 54406b77caec9a9d51c86e1d,
username: 'REDACTED',
password: '$2a$11$UWe1KUurnn5Pftfxwlhk7erM23cDTt8kjPlxywBOwq.HPEROT4xKS' } { allow: true }
Continuing the Code
var code = utils.uid(16)
var codeHash = crypto.createHash('sha1').update(code).digest('hex')
db.collection('authorizationCodes').save({code: codeHash, clientId: client._id, redirectURI: redirectURI, userId: user.username}, function(err) {
console.log({code: codeHash, clientId: client._id, redirectURI: redirectURI, userId: user.username});
This Console.Log Will Report This:
{ code: '11b811e7fec1f9cb940f62de9c082e060df0c556',
clientId: undefined,
redirectURI: 'http://www.REDACTED.net',
userId: 'REDACTED' }
if (err) return done(err)
done(null, code)
})
}))
As you can see, the clientId: that is the _id in the first array cannot be inserted (undefined). This is from the oauth2orize_authorization_grant_example.
Thank You for all of your Hard Work!