intuit / oauth-jsclient

Intuit's NodeJS OAuth client provides a set of methods to make it easier to work with OAuth2.0 and Open ID
https://developer.intuit.com/
Apache License 2.0
122 stars 156 forks source link

Revoking a revoked token returns generic error message #18

Closed belo32 closed 5 years ago

belo32 commented 5 years ago

The is the error I get back when I revoke an already revoked token. It would be great if it gave a error to indicate the token has already been revoked. Would be easier to handle that error.

Error: Response has an Error at OAuthClient. (/Users/bilal/workspace/mydoma-studio-api/node_modules/intuit-oauth/src/OAuthClient.js:621:42) at at process._tickDomainCallback (internal/process/next_tick.js:229:7)

belo32 commented 5 years ago

It's missing the error code in the response.

abisalehalliprasan commented 5 years ago

@belo32 : Is the token being revoked outside the scope of this client (is the token revoked outside your app ? ) If you are using this node client to revoke, the response should look like :

{  
   "token":{  
      "realmId":"realmID",
      "token_type":"bearer",
      "access_token":"revoked access_token",
      "refresh_token":"revoked refresh_token",
      "expires_in":12324255363668,
      "x_refresh_token_expires_in":12324255363668,
      "id_token":"revoked id_token",
      "latency":60000
   },
   "response":{  
      "url":"https://developer.api.intuit.com/v2/oauth2/tokens/revoke",
      "headers":{  
         "content-length":"0",
         "connection":"close",
         "server":"nginx",
         "date":"Mon, 15 Apr 2019 17:33:05 GMT",
         "strict-transport-security":"max-age=15552000",
         "intuit_tid":"3605978xxxxx-xxx-xxx-xxx2e89",
         "cache-control":"no-cache",
         "pragma":"no-cache",
         "expires":"-1"
      },
      "body":"",
      "status":200,
      "statusText":"OK"
   },
   "body":"",
   "json":null,
   "intuit_tid":"3605978xxxxx-xxx-xxx-xxx2e89"
} 

For posterity, the client should be able to handle the error responses irrespectively. Will handle this as part of the next release. Thanks.

belo32 commented 5 years ago

Thank you, the token was revoked during the scope of the client. It's just the code did not handle the updating the state properly at the time and the response we were getting back from the OauthClient was not clear.

abisalehalliprasan commented 5 years ago

Fixed with Release 1.2.0