Skip to content

Commit

Permalink
Fix syntax error and remove OAuth 2 configuration details.
Browse files Browse the repository at this point in the history
  • Loading branch information
fruchtose committed Nov 21, 2012
1 parent 354f6c0 commit 3494047
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions lib/modules/viadeo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ var oauthModule = require('./oauth2')

var viadeo = module.exports =
oauthModule.submodule('viadeo')
.apiHost('https://secure.viadeo.com')
.apiHost('https://api.viadeo.com')
.oauthHost('https://secure.viadeo.com')

.entryPath('/auth/viadeo')
.callbackPath('/auth/viadeo/callback')

.authPath("/oauth-provider/authorize2")
.authQueryParam('response_type', 'code')

.accessTokenPath('/oauth-provider/access_token2')
.accessTokenParam('grant_type', 'authorization_code')
.accessTokenHttpMethod('post')

.entryPath('/auth/viadeo')
.callbackPath('/auth/viadeo/callback')

.fetchOAuthUser( function (accessToken) {
var promise = this.Promise();
request.get({
url: 'https://api.viadeo.com/me',
qs: { access_token: accessToken }
}).on('success', function (data, res) {
promise.fulfill(data);
}).on('error', function (data, res) {
promise.fail(data);
}, function (err, res, body) {
if (err) return promise.fail(err);
if (parseInt(res.statusCode/100, 10) !== 2) {
return promise.fail({extra: {data: body, res: res}});
}
promise.fulfill(JSON.parse(body));
});
return promise;
})
});

0 comments on commit 3494047

Please sign in to comment.