intuit-oauth
Advanced tools
Comparing version 1.2.0 to 1.3.0
{ | ||
"name": "intuit-oauth", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Intuit Node.js client for OAuth2.0 and OpenID", | ||
@@ -5,0 +5,0 @@ "main": "./src/OAuthClient.js", |
@@ -213,6 +213,19 @@ [][ss1] | ||
When you no longer need the access_token, you could use the below helper method to revoke the tokens. You can also optionally pass the `access_token` or `refresh_token` to this helper method : | ||
When you no longer need the access_token, you could use the below helper method to revoke the tokens. | ||
```javascript | ||
oauthClient.revoke() | ||
.then(function(authResponse) { | ||
console.log('Tokens revoked : ' + JSON.stringify(authResponse.json())); | ||
}) | ||
.catch(function(e) { | ||
console.error("The error message is :"+e.originalMessage); | ||
console.error(e.intuit_tid); | ||
}); | ||
``` | ||
Alternatively you can also pass `access_token` or `refresh_token` to this helper method using the `params` object: refer to - [Getter / Setter for Token](#getter-/-setter-for-token ) section to know how to retrieve the `token` object | ||
```javascript | ||
oauthClient.revoke(params) | ||
@@ -227,3 +240,3 @@ .then(function(authResponse) { | ||
``` | ||
** Note ** : `params` is the Token JSON object as shown below : | ||
** Note ** : `params` is the Token JSON object as shown below : ( _If you do not pass the `params` then the token object of the client would be considered._) | ||
@@ -236,7 +249,12 @@ ``` | ||
"x_refresh_token_expires_in":15552000, | ||
"access_token":"<access_token>" | ||
"access_token":"<access_token>", | ||
"createdAt": "(Optional Default = Date.now()) <Milliseconds> from the unix epoch" | ||
} | ||
``` | ||
** Note ** : If you do not pass the `params` then the token object of the client would be considered. | ||
** Note ** : | ||
### Getter / Setter for Token | ||
@@ -243,0 +261,0 @@ |
@@ -132,3 +132,15 @@ 'use strict'; | ||
/** | ||
* disconnect () | ||
*/ | ||
app.get('/disconnect', function(req,res){ | ||
console.log('The disconnect called '); | ||
var authUri = oauthClient.authorizeUri({scope:[OAuthClient.scopes.OpenId,OAuthClient.scopes.Email],state:'intuit-test'}); | ||
res.redirect(authUri); | ||
}); | ||
/** | ||
@@ -141,5 +153,6 @@ * Start server on HTTP (will use ngrok for HTTPS forwarding) | ||
redirectUri = `${server.address().port}` + '/callback'; | ||
console.log(`💳 See the Sample App in your browser : ` + 'http://localhost:' + `${server.address().port}`); | ||
console.log(`💳 Copy this into Redirect URI on the browser : ` + 'http://localhost:' + `${server.address().port}` + '/callback'); | ||
console.log(`💻 Make Sure this redirect URI is also copied on your app in : https://developer.intuit.com`); | ||
console.log(`💳 Step 1 : Paste this URL in your browser : ` + 'http://localhost:' + `${server.address().port}`); | ||
console.log('💳 Step 2 : Copy and Paste the clientId and clientSecret from : https://developer.intuit.com') | ||
console.log(`💳 Step 3 : Copy Paste this callback URL into redirectURI :` + 'http://localhost:' + `${server.address().port}` + '/callback'); | ||
console.log(`💻 Step 4 : Make Sure this redirect URI is also listed under the Redirect URIs on your app in : https://developer.intuit.com`); | ||
} | ||
@@ -161,5 +174,6 @@ | ||
redirectUri = url + '/callback'; | ||
console.log(`💳 See the Sample App in your browser: ${url}`); | ||
console.log(`💳 Copy and paste this Redirect URI on the browser : ${redirectUri}`); | ||
console.log(`💻 Make Sure this redirect URI is also copied on your app in : https://developer.intuit.com`); | ||
console.log(`💳 Step 1 : Paste this URL in your browser : ${url}`); | ||
console.log('💳 Step 2 : Copy and Paste the clientId and clientSecret from : https://developer.intuit.com') | ||
console.log(`💳 Step 3 : Copy Paste this callback URL into redirectURI : ${redirectUri}`); | ||
console.log(`💻 Step 4 : Make Sure this redirect URI is also listed under the Redirect URIs on your app in : https://developer.intuit.com`); | ||
@@ -166,0 +180,0 @@ } |
@@ -20,4 +20,4 @@ { | ||
"ngrok": "^2.2.9", | ||
"intuit-oauth": "1.1.1" | ||
"intuit-oauth": "1.3.0" | ||
} | ||
} |
@@ -56,5 +56,6 @@ | ||
```bash | ||
💳 See the Sample App in your browser : http://localhost:8000 | ||
💳 Copy this into Redirect URI on the browser : http://localhost:8000/callback | ||
💻 Make Sure this redirect URI is also copied on your app in : https://developer.intuit.com | ||
💳 Step 1 : Paste this URL in your browser : http://localhost:8000 | ||
💳 Step 2 : Copy and Paste the clientId and clientSecret from : https://developer.intuit.com | ||
💳 Step 3 : Copy Paste this callback URL into `redirectURI` : http://localhost:8000/callback | ||
💻 Step 4 : Make Sure this redirect URI is also listed under the Redirect URIs on your app in : https://developer.intuit.com | ||
``` | ||
@@ -66,5 +67,6 @@ | ||
```bash | ||
💻 See the Sample App in your browser: https://9b4ee833.ngrok.io | ||
💳 Copy and paste this Redirect URI on the browser : https://9b4ee833.ngrok.io/callback | ||
💻 Make Sure this redirect URI is also copied on your app in : https://developer.intuit.com | ||
💳 Step 1 : Paste this URL in your browser : https://9b4ee833.ngrok.io | ||
💳 Step 2 : Copy and Paste the clientId and clientSecret from : https://developer.intuit.com | ||
💳 Step 3 : Copy Paste this callback URL into `redirectURI` : https://9b4ee833.ngrok.io/callback | ||
💻 Step 4 : Make Sure this redirect URI is also listed under the Redirect URIs on your app in : https://developer.intuit.com | ||
``` | ||
@@ -79,3 +81,3 @@ | ||
* https://github.intuit.com/abisalehalliprasan/oauth-jsclient | ||
* https://github.com/intuit/oauth-jsclient | ||
@@ -88,3 +90,3 @@ Intuit OAuth2.0 API Reference | ||
* https://developer.intuit.com/v2/ui#/playground | ||
* https://developer.intuit.com/app/developer/playground | ||
@@ -95,5 +97,5 @@ ## Contributions | ||
Please report these on [Issue Tracker in Github](https://github.intuit.com/abisalehalliprasan/oauth-jsclient/issues). | ||
Please report these on [Issue Tracker in Github](https://github.com/intuit/oauth-jsclient/issues). | ||
[ss1]: https://help.developer.intuit.com/s/samplefeedback?cid=9010&repoName=Intuit-OAuth2.0-Sample-NodeJS |
@@ -84,3 +84,4 @@ /** | ||
realmId: this.realmId, | ||
id_token: this.id_token | ||
id_token: this.id_token, | ||
createdAt: this.createdAt | ||
}; | ||
@@ -123,5 +124,3 @@ | ||
Token.prototype.isAccessTokenValid = function() { | ||
return this._checkExpiry(this.expires_in); | ||
}; | ||
@@ -134,7 +133,5 @@ | ||
Token.prototype.isRefreshTokenValid = function() { | ||
return this._checkExpiry(this.x_refresh_token_expires_in); | ||
}; | ||
module.exports = Token; |
@@ -270,3 +270,7 @@ /** | ||
var authResponse = res.json ? res : null; | ||
this.log('info','Refresh Token () response is : ',JSON.stringify(authResponse, null, 2)); | ||
//New changes that are added | ||
var json = authResponse && authResponse.getJson() || res; | ||
this.token.setToken(json); | ||
this.log('info','Refresh usingToken () response is : ',JSON.stringify(authResponse, null, 2)); | ||
return authResponse; | ||
@@ -295,7 +299,2 @@ | ||
/** | ||
* Check if the tokens exist and are valid | ||
*/ | ||
this.validateToken(); | ||
var body = {}; | ||
@@ -302,0 +301,0 @@ |
189998
1629
500