Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
slickplaid
committed
Jun 24, 2011
1 parent
fbef0e3
commit b41ec0b
Showing
1 changed file
with
35 additions
and
0 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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,35 @@ | |||
var oauthModule = require('./oauth') | |||
, OAuth = require('oauth').OAuth; | |||
|
|||
var vimeo = module.exports = | |||
oauthModule.submodule('vimeo') | |||
.definit( function () { | |||
this.oauth = new OAuth( | |||
this.oauthHost() + this.requestTokenPath() | |||
, this.oauthHost() + this.accessTokenPath() | |||
, this.consumerKey() | |||
, this.consumerSecret() | |||
, '1.0', null, 'HMAC-SHA1', null | |||
); | |||
}) | |||
|
|||
.apiHost('http://vimeo.com/api/rest/v2') | |||
.oauthHost('http://vimeo.com') | |||
|
|||
.requestTokenPath('/oauth/request_token') | |||
.authorizePath('/oauth/authorize') | |||
.accessTokenPath('/oauth/access_token') | |||
|
|||
.entryPath('/auth/vimeo') | |||
.callbackPath('/auth/vimeo/callback') | |||
|
|||
.fetchOAuthUser( function (accessToken, accessTokenSecret, params) { | |||
var promise = this.Promise(); | |||
console.log(params, accessToken, accessTokenSecret); | |||
this.oauth.get(this.apiHost() + '?format=json&method=vimeo.people.getInfo&user_id=' + accessTokenSecret, accessToken, accessTokenSecret, function (err, data) { | |||
if (err) return promise.fail(err); | |||
var oauthUser = JSON.parse(data.person); | |||
return promise.fulfill(oauthUser); | |||
}); | |||
return promise; | |||
}); |