ionic-appauth icon indicating copy to clipboard operation
ionic-appauth copied to clipboard

Token expiration check

Open nsandeep5 opened this issue 4 years ago • 2 comments

Hi Matt, I want to check token expiration before call any API Call., but as part of login success am able to see the params like accessToken, expiresIn, idToken, issuedAt, scope, tokenType. Could please help if there is way to get any param which gives that the token expired staus. so that i can verify on that and move further.

Thanks & Regards Sandeep N

nsandeep5 avatar Nov 03 '21 07:11 nsandeep5

Hi Sandeep, the expiration date is coded in the access token. It is a JWT, so have a look at jwt.io for example. Also have a look at the getValidToken() method in the AuthService. It might do what you are searching for. André

anweihe avatar Nov 15 '21 20:11 anweihe

Hi André , Thanks for your reply, I Have checked expiry using JWT, and it is giving correct response. But no am getting one more issue the getValidToken() is not giving the response after the token expiry , we are checking with RefreshToken(), But RefreshToken is giving action:refresh failed. Please suggest on this.

Thanks & Regards Sandeep N

ghost avatar Nov 18 '21 02:11 ghost