-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/akinsella/everyauth into …
…akinsella-master Conflicts: README.md example/conf.js example/server.js example/views/home.jade
- Loading branch information
Showing
7 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ issues | |
IRC.md | ||
playground.js | ||
CHANGES | ||
npm-debug.log | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,7 @@ var usersMailruId = {}; | |
var usersByMendeleyId = {}; | ||
var usersByDcId = {}; | ||
var usersByWeiboId = {}; | ||
var usersByRunKeeperId = {}; | ||
var usersByLogin = { | ||
'[email protected]': addUser({ login: '[email protected]', password: 'password'}) | ||
}; | ||
|
@@ -389,6 +390,14 @@ everyauth.mendeley | |
}) | ||
.redirectPath('/'); | ||
|
||
everyauth.runkeeper | ||
.appId(conf.runkeeper.appId) | ||
.appSecret(conf.runkeeper.appSecret) | ||
.findOrCreateUser(function(sess, accessToken, accessSecret, user) { | ||
return usersByRunKeeperId[user.userID] || (usersByRunKeeperId[user.userID] = addUser('runkeeper', user)); | ||
}) | ||
.redirectPath('/'); | ||
|
||
everyauth | ||
.soundcloud | ||
.appId(conf.soundcloud.appId) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
var oauthModule = require('./oauth2') | ||
, request = require('request'); | ||
|
||
var runkeeper = module.exports = | ||
oauthModule.submodule('runkeeper') | ||
.configurable({ | ||
scope: 'specify types of access: (no scope), non-expiring' | ||
}) | ||
.apiHost('https://api.runkeeper.com') | ||
.oauthHost('https://runkeeper.com') | ||
.authPath('/apps/authorize') | ||
.accessTokenPath('/apps/token') | ||
.entryPath('/auth/runkeeper') | ||
.callbackPath('/auth/runkeeper/callback') | ||
.authQueryParam('response_type', 'code') | ||
.authQueryParam('scope', function () { | ||
return this._scope && this.scope(); | ||
}) | ||
.accessTokenHttpMethod('post') | ||
.postAccessTokenParamsVia('data') | ||
.accessTokenParam('grant_type', 'authorization_code') | ||
.fetchOAuthUser(function (accessToken) { | ||
console.log("Access Token: ", accessToken); | ||
var promise = this.Promise(); | ||
request.get({ | ||
url: this.apiHost() + '/user' | ||
, headers: { | ||
'Authorization': 'Bearer ' + accessToken | ||
} | ||
}, function (err, res, body) { | ||
if (err) return promise.fail(err); | ||
if (parseInt(res.statusCode / 100, 10) !== 2) { | ||
return promise.fail(body); | ||
} | ||
return promise.fulfill(JSON.parse(body)); | ||
}); | ||
|
||
return promise; | ||
}); |
Binary file not shown.