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
120 stars 154 forks source link

Wrong createdAt date on OAuthClient.token.getToken() response #119

Open edyrkaj opened 2 years ago

edyrkaj commented 2 years ago

Description:

Version: "intuit-oauth": "^4.0.0",

Node 10.24

When I use existing tokens from the storage and validate the token before accessing other methods of QB method: OAuthClient.isAccessTokenValid() returns always true.

{ token_type: 'bearer',
      access_token: xxx',
      expires_in: 3600,
      refresh_token: 'xxx',
      x_refresh_token_expires_in: 0,
      realmId: 'yy',
      id_token: '',
      createdAt: 1631695486623 }

On this response I see that createdAt timestamp is always time when I call the method OAuthClient.token.getToken() which I think is wrong because it should be the time when token is created in order to make the validation for expired token.

OAuthClient.token.getToken() this method is broken.

edyrkaj commented 2 years ago

Just found that token needs to set value from place where we store last time connected with QB and when token is created https://github.com/intuit/oauth-jsclient/blob/master/src/access-token/Token.js _checkExpiry

singhikjot commented 2 years ago

@edyrkaj Can you please assign this issue to me and also add a hacktoberfest tag