Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
64d1bff
Merge pull request #10 from intuit/develop
abisalehalliprasan Dec 17, 2018
b2d7074
New Release to Support the Token Setting Methodology
abisalehalliprasan Feb 11, 2019
32ee65b
New Release to Support the Token Setting Methodology-1
abisalehalliprasan Feb 11, 2019
f55b068
Adding Changes to README.md
abisalehalliprasan Mar 4, 2019
3b40768
README.md changes
abisalehalliprasan Mar 5, 2019
1d5b817
Setting the Token methodology fixed - Issue #16
abisalehalliprasan Mar 12, 2019
11dd968
Setting the Token methodology fixed - Issue #16
abisalehalliprasan Mar 12, 2019
848fba3
Fixes the expiry date
ryan-sandy Apr 23, 2019
eb7a458
Merge pull request #20 from ryan-sandy/master
abisalehalliprasan Apr 25, 2019
aaea3ff
Improved Error Message for HTTP4XX Calls
abisalehalliprasan Apr 25, 2019
54c69a7
Merge branch 'master' of https://github.com/intuit/oauth-jsclient
abisalehalliprasan Apr 25, 2019
f641217
New Release 1.2.0
abisalehalliprasan Apr 25, 2019
d3f3734
New Release Candidate 1.2.0
abisalehalliprasan Apr 25, 2019
6c62bc0
New Release Candidate 1.2.0
abisalehalliprasan Apr 25, 2019
97e5704
Fixing the README.md per #5
abisalehalliprasan May 29, 2019
f31deef
Fixing the README.md per #5
abisalehalliprasan May 29, 2019
0be546b
Fixing the README.md per #5
abisalehalliprasan May 29, 2019
be0c4db
Token Validation for Revoke functionality : Fixed
abisalehalliprasan Jul 9, 2019
caeb3c6
add the posibility to support POST methods like CREATE INVOICE
jonymusky Jul 12, 2019
5ba6b1c
Update package.json
jonymusky Jul 12, 2019
41bdaa3
fix
jonymusky Jul 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Setting the Token methodology fixed - Issue #16
  • Loading branch information
abisalehalliprasan committed Mar 12, 2019
commit 1d5b8177869652ba8d373a8746979b81d2ca491c
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ var authToken = oauthClient.token.getToken();
```javascript

// To Set the retrieved tokens explicitly using Token Object but the same instance
oauthClient.token = new Token(authToken);
oauthClient.setToken(authToken);


OR

Expand All @@ -278,7 +279,11 @@ The OAuth Client library converts the accessToken and refreshToken expiry time t
this.expires_in = Date.now() + (tokenData.expires_in * 1000);
this.x_refresh_token_expires_in = Date.now() + (tokenData.x_refresh_token_expires_in * 1000);

so if you're providing the token that was returned from `createToken` or `refresh` then be sure you set the token as shown above.
so if you're providing the token that was returned from `createToken` or `refresh` then be sure you set the token as shown above or refer below :

```javascript
oauthClient.setToken(authToken);
```


### Migrate OAuth1.0 Tokens to OAuth2.0
Expand Down
14 changes: 14 additions & 0 deletions src/OAuthClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ OAuthClient.prototype.createToken = function(uri) {

};


/**
* Refresh Token { Refresh access_token }
* @param {Object} params.refresh_token (optional)
Expand Down Expand Up @@ -705,6 +706,19 @@ OAuthClient.prototype.getToken = function() {
return this.token;
};


/**
* Set Token
* @param {Object}
* @returns {Token}
*/
OAuthClient.prototype.setToken = function(params) {

this.token = new Token(params);
return this.token;
};


/**
* Get AuthHeader
* @returns {string} authHeader
Expand Down