Open
Description
Seeing intermittent errors calling OAuth.auth()
, where it falls into the fail()
block. The err
is simply:
[Error: State is not matching]
What does that mean? We are using redis to store sessions by the way.
Here is the full block of code we are using:
////
// OAuth signin route
////
app.post('/oauth/signin', [
oauthLogger,
jsonParser,
function(req, res) {
if(!req.body) {
res.status(400).send({
error: {
status_code: 400,
status: 'Bad Request',
message: 'Missing required body'
}
}).end();
return;
}
if(!req.body.provider || !req.body.code) {
res.status(400).send({
error: {
status_code: 400,
status: 'Bad Request',
message: 'Missing required parameter'
}
}).end();
return;
}
OAuth.auth(req.body.provider, req.session, {
code: req.body.code
})
.then(function(requestObject) {
return requestObject.me();
})
.then(function(me) {
if(!me.raw.id) {
res.status(500).send({
error: {
status_code: 500,
status: 'Internal Server Error',
message: 'Missing required id'
}
}).end();
return;
}
req.session.oauth.provider = req.body.provider;
req.session.oauth.id = me.raw.id;
res.status(200).send({
email: me.email,
avatar: me.avatar
}).end();
})
.fail(function(err) {
res.status(503).send({
error: {
status_code: 503,
status: 'Service Unavailable',
message: err.toString()
}
}).end();
});
}
]);
Metadata
Metadata
Assignees
Labels
No labels