Skip to content

Commit

Permalink
Added Vimeo OAuth Module.
Browse files Browse the repository at this point in the history
  • Loading branch information
slickplaid committed Jun 24, 2011
1 parent fbef0e3 commit b41ec0b
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions lib/modules/vimeo.js
@@ -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;
});

0 comments on commit b41ec0b

Please sign in to comment.