ordercloud-api / ordercloud-javascript-sdk

The official Javascript SDK for the OrderCloud eCommerce platform
MIT License
16 stars 16 forks source link

Auth and Token Query #85

Closed senthilmcan closed 1 year ago

senthilmcan commented 1 year ago

Hi, i am using ordercloude javascript sdk for Auth.Login, and save the token 'Tokens.SetAccessToken(token)'.

Following are my query

  1. How to validate the user is Authenticated or the token is expired?
  2. I am not able to find the option for Logout.
crhistianramirez commented 1 year ago
  1. You can decode the jwt token and look at the exp claim. We do this internally, you can check out this code to see the logic performed
  2. Being "logged in" is just a matter of having a valid ordercloud token so being logged out would be not having a token. You can remove the access token by calling Tokens.RemoveAccessToken

In the future, please post questions to the community slack, we'd like to keep github issues for bug reports or feature requests.