Permalink
Browse files

Added Vimeo OAuth Module.

  • Loading branch information...
slickplaid committed Jun 24, 2011
1 parent fbef0e3 commit b41ec0b194d0b9491e350981fdc1557e15aea742
Showing with 35 additions and 0 deletions.
  1. +35 −0 lib/modules/vimeo.js
View
@@ -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.