Permalink
Browse files

Initial Release

  • Loading branch information...
1 parent 55344a9 commit d668ef736b9ed9ee9c8b2c108eb40a5d37a69f01 @nijikokun nijikokun committed Mar 27, 2013
Showing with 2,027 additions and 4 deletions.
  1. +2 −1 .gitignore
  2. +8 −0 LICENSE
  3. +7 −0 Makefile
  4. +63 −3 README.md
  5. +4 −0 index.js
  6. +424 −0 lib/oauth.js
  7. +152 −0 lib/oauth2.js
  8. +268 −0 lib/sha1.js
  9. +33 −0 lib/utils.js
  10. +38 −0 package.json
  11. +829 −0 tests/oauth.js
  12. +199 −0 tests/oauth2.js
View
@@ -10,5 +10,6 @@ lib-cov
pids
logs
results
+node_modules
-npm-debug.log
+npm-debug.log
View
@@ -0,0 +1,8 @@
+The MIT License (MIT)
+Copyright (c) <2013> <Mashape, Nijiko Yonskai>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -0,0 +1,7 @@
+#
+# Run all tests
+#
+test:
+ @@node_modules/.bin/mocha -R spec tests/*
+
+.PHONY: test install
View
@@ -1,4 +1,64 @@
-mashape-oauth
-=============
+# Moth
+
+OAuth Modules for Node.js - Supporting RSA, HMAC, PLAINTEXT, 2,3-Legged, 1.0a, Echo, XAuth, and 2.0
+
+# Installation
+
+```
+npm install mashape-oauth
+```
+
+# Usage
+
+Using OAuth (1.x, XAuth, Echo):
+
+```javascript
+var OAuth = require('mashape-oauth').OAuth;
+
+var oa = new OAuth({ /* ... options ... */ }, callback);
+```
+
+**Argument Documentation**
+
+- options `{Object}` OAuth Request Options
+ - echo `{Object}` *Optional;* If it exists we treat the request as an echo request. See [Twitter](https://dev.twitter.com/docs/auth/oauth/oauth-echo).
+ - echo.verifyCredentials `{String}` What is the credentials URI to delegate against?
+ - realm `{String}` *Optional;* Access Authentication Framework Realm Value, Commonly used in Echo Requests, allowed in all however:
+ [Section 3.5.1](http://tools.ietf.org/html/rfc5849#section-3.5.1)
+ - requestUrl `{String}` Request Token URL, [Section 6.1](http://oauth.net/core/1.0/#auth_step1)
+ - accessUrl `{String}` Access Token URL, [Section 6.2](http://oauth.net/core/1.0/#auth_step2)
+ - callback `{String}` URL the Service Provider will use to redirect User back to Consumer after obtaining User Authorization has been completed.
+ [Section 6.2.1](http://oauth.net/core/1.0/#auth_step2)
+ - consumerKey `{String}` The Consumer Key
+ - consumerSecret `{String}` The Consumer Secret
+ - version `{String}` *Optional;* By spec this is `1.0` by default. [Section 6.3.1](http://oauth.net/core/1.0/#auth_step3)
+ - signatureMethod `{String}` Type of signature to generate, must be one of:
+ - PLAINTEXT
+ - RSA-SHA1
+ - HMAC-SHA1
+ - nonceLength `{Number}` *Optional;* Length of nonce string. Default `32`
+ - headers `{Object}` *Optional;* Headers to be sent along with request, by default these are already set.
+ - clientOptions `{Object}` *Optional;* Contains `requestTokenHttpMethod` and `accessTokenHttpMethod` value.
+ - parameterSeperator `{String}` *Optional;* Seperator for OAuth header parameters, default is `,`
+- callback `{String}` *Optional;* callback uri, over-rides options callback.
+
+Using OAuth2:
+
+```javascript
+var OAuth2 = require('mashape-oauth').OAuth2;
+
+var oa = new OAuth2({ /* ... options ... */ }, callback);
+```
+
+**Argument Documentation:**
+
+- options `{Object}` OAuth Request Options
+ - clientId `{String}` Client Identifier
+ - clientSecret `{String}` Client Secret
+ - baseUrl `{String}` Base url of OAuth request
+ - authorizationUrl `{String}` *Optional;* Authorization endpoint, default is `/oauth/authorize`
+ - authorizationMethod `{String}` *Optional;* Authorization Header Method, default is `Bearer`
+ - accessTokenUrl `{String}` *Optional;* Access Token Endpoint, default is `/oauth/access_token`
+ - accessTokenName `{String}` *Optional;* Access Token Parameter Name, default is `access_token`
+ - headers `{Object}` *Optional;* Custom headers we wish to pass along
-Mashape OAuth Modules for Node.js - Supporting RSA, HMAC, PLAINTEXT, 2,3-Legged, 1.0a, Echo, XAuth, and 2.0
View
@@ -0,0 +1,4 @@
+module.exports = exports = {
+ OAuth: require('./lib/oauth'),
+ OAuth2: require('./lib/oauth2')
+};
Oops, something went wrong.

0 comments on commit d668ef7

Please sign in to comment.