Skip to content

Commit

Permalink
slight change
Browse files Browse the repository at this point in the history
  • Loading branch information
ystskm committed Apr 16, 2013
1 parent 87208e0 commit 79b980a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 65 deletions.
110 changes: 48 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,84 +1,70 @@
node-oauth
:: node-oauth ::
=

An adaptor for OAuth 1.0 and OAuth 2.0 API.
##Abstract
#### An adaptor for OAuth 1.0 and OAuth 2.0 API.

Install
-
##Install##

npm install node-oauth
To install the most recent release from npm, run:

npm install node-oauth

Usage
-
##Usage##

require `node-oauth`
> require `node-oauth`
```js
var OAuth = require('node-oauth');
var OAuth = require('node-oauth');

```
> set your application OAuth setting file.
set your application OAuth setting file.
OAuth = OAuth("../sample/object-oauth.js")

```js
OAuth = OAuth("../sample/object-oauth.js")
> jump to Login page.
> "response" is necessary for redirect.
```
OAuth.authorize('facebook',{
response: res,
endCallback: function(err) {
if(err)
onError(err);
}
});

jump to Login page.
"response" is necessary for redirect.
> (OAuth 1.0)
> if you don't want to go authorize page everytime, you can control after getting request token.
> Authorizer object returns. It have setting datas on its fields.
```js
OAuth.authorize('facebook',{
response: res,
endCallback: function(err) {
if(err)
onError(err);
}
});
var oauthAuthorizer = OAuth.authorize('twitter', {
auto: false
});

```
> get access token in redirect page
> Tokener object returns.
(OAuth 1.0)
if you don't want to go authorize page everytime, you can control after getting request token.
Authorizer object returns. It have setting datas on its fields.
var oauthTokener = OAuth.access(oauth['type'], {
href: location.href
}, authorized);

```js
var oauthAuthorizer = OAuth.authorize('twitter', {
auto: false
});
> if you want to set access_token externaly, ( that is , not via url )
```
oauthTokener.set({
request_token: oauth['req_tkn'],
access_token: oauth['oac_tkn'],
access_token_secret: oauth['oac_tkn_scr']
});

get access token in redirect page
Tokener object returns.
> access to api with name (set in setting file) / url.
> data returns after JSON.parse(api-response).
```js
var oauthTokener = OAuth.access(oauth['type'], {
href: location.href
}, authorized);
oauthTokener.get("credentials", {}, function(err, data){
if(err)
return ...
...
});

```
##Change Log##

if you want to set access_token externaly, ( that is , not via url )

````
oauthTokener.set({
request_token: oauth['req_tkn'],
access_token: oauth['oac_tkn'],
access_token_secret: oauth['oac_tkn_scr']
});
````

access to api with name (set in setting file) / url. data returns after JSON.parse(api-response).

```js
oauthTokener.get("credentials", {}, function(err, data){
if(err)
return ...
...
});

```
* 2013/4/16
+ 0.1.2 release
+ repository owner is changed to ystskm
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"engines": {
"node": ">=0.8.21"
},
"dependencies": {
},
"licenses": [
{
"type": "MIT",
Expand All @@ -19,9 +21,6 @@
],
"readmeFilename": "README.md",
"gitHead": "1a313d9accf7ede43ebd829f417ea99b21f293b1",
"scripts": {
"test": "npm install node-oauth"
},
"keywords": [
"oauth",
"oauth2"
Expand Down

0 comments on commit 79b980a

Please sign in to comment.