Skip to content

Commit

Permalink
Example app: show whole profile of a user
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebest committed Aug 12, 2016
1 parent 3873c1a commit 68c13be
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
13 changes: 6 additions & 7 deletions examples/login/app.js
Expand Up @@ -31,16 +31,15 @@ passport.deserializeUser(function(obj, done) {
// Strategies in Passport require a `verify` function, which accept
// credentials (in this case, an accessToken, refreshToken, and VK
// profile), and invoke a callback with a user object.
passport.use(new VkStrategy({
passport.use(new VkStrategy(
{
clientID: VK_APP_ID,
clientSecret: VK_APP_SECRET,
callbackURL: "http://localhost:3000/auth/vk/callback"
callbackURL: "http://localhost:3000/auth/vk/callback",
scope: ['email'],
profileFields: ['email'],
},
function verify(accessToken, refreshToken, profile, done) {

console.log('access token: ', accessToken);
console.log('refreshToken: ', refreshToken);
console.log('profile: ', profile);
function verify(accessToken, refreshToken, params, profile, done) {

// asynchronous verification, for effect...
process.nextTick(function () {
Expand Down
4 changes: 2 additions & 2 deletions examples/login/package.json
Expand Up @@ -3,8 +3,8 @@
"version": "0.0.0",
"dependencies": {
"express": "4.14.0",
"ejs": ">= 0.0.0",
"passport": ">= 0.0.0"
"ejs": "2.5.1",
"passport": "0.3.2"
},
"scripts": {
"start": "node app"
Expand Down
6 changes: 6 additions & 0 deletions examples/login/views/index.ejs
Expand Up @@ -11,6 +11,12 @@
<p>VK Username: <%= user.username %></p>
<p>VK Name: <%= user.displayName %></p>
<p>
<pre>
<%= JSON.stringify(user, null, 2) %>
</pre>
</p>
<p>
<a href="/logout">Log out</a>
</p>
Expand Down

0 comments on commit 68c13be

Please sign in to comment.