ciaranj/connect-auth — Issue #73: Google2 doesn't work
Author: zandaq
Created: 2011-11-26 21:29:52+00:00
State: open

Hi,
I've modified a little bit Express Facebook example to work with Google2, but it doesn't work and returns no error. To be precise, the code below returns: {"scopedUsers":{}} null

```
...
express.cookieParser(),
express.session({ secret: 'session secret' }),
auth([
auth.Google2({appId : "appId", appSecret: "appsecret", scope: "email", callback: "https://domain/users"})
]),
...
api.get('/users', function(req, res){
req.authenticate([req.param('method')], function(error, authenticated) {
if(authenticated) {
res.end("

Hello Google user:" + JSON.stringify( req.getAuthDetails() ) + ".

")
}
else {
res.end(JSON.stringify(req.getAuthDetails())+' '+JSON.stringify(error));
}
});
});
api.get('/somepage', function(req, res){
var sign_in_link= "/users?method=google2&redirectUrl=" + escape(req.url);
if( req.isAuthenticated() ) {
res.end('

Signed in with Google

')
}
else {
res.end('

Sign in with Google

')
}
});
...
```
I've also tried modifications from here: https://github.com/ciaranj/connect-auth/pull/70 but it doesn't work either.