8000 updated the /me endpoint for the new .auth method · cethap/sdk-node-tutorial@a1250bb · GitHub
[go: up one dir, main page]

Skip to content

Commit a1250bb

Browse files
committed
updated the /me endpoint for the new .auth method
1 parent 7e6c10f commit a1250bb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,15 @@ app.post('/oauth/signin', function (req, res) {
5858

5959

6060
app.get('/me', function (req, res) {
61-
var request_object = oauth.create('facebook');
62-
// Here we perform a request using the .me() method.
61+
// Here we first build a request object from the session with the auth method.
62+
// Then we perform a request using the .me() method.
6363
// This retrieves a unified object representing the authenticated user.
6464
// You could also use .get('/me') and map the results to fields usable from
6565
// the front-end (which waits for the fields 'name', 'email' and 'avatar').
66-
request_object.me()
66+
OAuth.auth('google', req.session)
67+
.then(function (request_object) {
68+
return request_object.me();
69+
})
6770
.then(function (user_data) {
6871
res.json(user_data);
6972
})

0 commit comments

Comments
 (0)
0