Verify Access Token with cidaas
The above steps are showing how to get access token from cidaas. now we will see about how to verify the given access token is valid or not with cidaas.
curl -X GET \
yourcidaasurl/oauth2-login/oauth2/checktoken \
-H 'access_token: youraccesstoken'
yourcidaasurl/oauth2-login/oauth2/checktoken \
-H 'access_token: youraccesstoken'
Response
This will give you true if the token is valid , other wise it will give false
Note
If you are using interceptors this steps will be taken care in each request.
If you using the Javascript SDK, you just need to add the callback function to cidaas SDK
tokentimeout_callback
, the SDK will ping every 60 seconds to the cidaas server and if the token expired it will call this callback.
cidaas.tokentimeout_callback = function(){
console.log("token expired");
// do your logout or request the refresh token from your server.
}