Skip to content

Commit

Permalink
Merge pull request #395 from nathankleyn/master
Browse files Browse the repository at this point in the history
EyeEm oAuth module
  • Loading branch information
bnoguchi committed Jun 4, 2013
2 parents ce9fe0b + 8ab18ec commit f873afd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -58,6 +58,7 @@ So far, `everyauth` enables you to login via:
<td> <a href="https://github.com/kaizenpack">kaizenpack</a>
<tr> <td> <img src="https://github.com/bnoguchi/everyauth/raw/master/media/runkeeper.ico" style="vertical-align:middle"> RunKeeper
<td> <a href="https://github.com/akinsella">Alexis Kinsella</a>
<tr> <td> <img src="https://github.com/bnoguchi/everyauth/raw/master/media/eyeem.ico" style="vertical-align:middle"> EyeEm <td> <a href="https://github.com/nathankleyn">Nathan Kleyn</a>
</tbody>
<tbody id=misc>
<tr> <td> <img src="https://github.com/bnoguchi/everyauth/raw/master/media/box.ico" style="vertical-align:middle"> Box.net <td>
Expand Down Expand Up @@ -2852,6 +2853,8 @@ Thanks to the following contributors for the following modules:
- Evernote
- [Chris Leishman](https://github.com/chrisleishman)
- SoundCloud
- [Nathan Kleyn](https://github.com/nathankleyn)
- EyeEm

## MIT License
Copyright (c) 2011 by Brian Noguchi
Expand Down
24 changes: 24 additions & 0 deletions lib/modules/eyeem.js
@@ -0,0 +1,24 @@
var oauthModule = require('./oauth2');

module.exports = oauthModule.submodule('eyeem')
.oauthHost('https://www.eyeem.com')
.apiHost('https://www.eyeem.com/api/v2')
.entryPath('/auth/eyeem')
.callbackPath('/auth/eyeem/callback')
.authQueryParam('response_type', 'code')
.accessTokenPath('/api/v2/oauth/token')
.accessTokenParam('grant_type', 'authorization_code')

.fetchOAuthUser( function (accessToken) {
var promise = this.Promise();

this.oauth.get(this.apiHost() + '/users/me', accessToken, function (err, data) {
var oauthUser;

if (err) return promise.fail(err.error_message);

oauthUser = JSON.parse(data).user;
promise.fulfill(oauthUser);
});
return promise;
});
Binary file added media/eyeem.ico
Binary file not shown.

0 comments on commit f873afd

Please sign in to comment.