Created
November 22, 2012 22:19
-
-
Save fruchtose/4133131 to your computer and use it in GitHub Desktop.
Everyauth OAuth 1.0a configuration metaprogramming
This file contains hidden or 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
everyModule.submodule('oauth') | |
.configurable({ | |
apiHost: 'e.g., https://api.twitter.com' | |
, oauthHost: 'the host for the OAuth provider' | |
, requestTokenPath: "the path on the OAuth provider's domain where we request the request token, e.g., /oauth/request_token" | |
, accessTokenPath: "the path on the OAuth provider's domain where we request the access token, e.g., /oauth/access_token" | |
, authorizePath: 'the path on the OAuth provider where you direct a visitor to login, e.g., /oauth/authorize' | |
, sendCallbackWithAuthorize: 'whether you want oauth_callback=... as a query param send with your request to /oauth/authorize' | |
, consumerKey: 'the api key provided by the OAuth provider' | |
, consumerSecret: 'the api secret provided by the OAuth provider' | |
, myHostname: 'e.g., http://localhost:3000 . Notice no trailing slash' | |
, alwaysDetectHostname: 'does not cache myHostname once. Instead, re-detect it on every request. Good for multiple subdomain architectures' | |
, redirectPath: 'Where to redirect to after a failed or successful OAuth authorization' | |
, convertErr: '(DEPRECATED) a function (data) that extracts an error message from data arg, where `data` is what is returned from a failed OAuth request' | |
, authCallbackDidErr: 'Define the condition for the auth module determining if the auth callback url denotes a failure. Returns true/false.' | |
}) | |
.definit( function () { | |
this.oauth = new OAuth( | |
this.oauthHost() + this.requestTokenPath() | |
, this.oauthHost() + this.accessTokenPath() | |
, this.consumerKey() | |
, this.consumerSecret() | |
, '1.0', null, 'HMAC-SHA1'); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment