0
votes

I need to change the access token expiry time in WSO2. I have tried editing the element in identity.xml for both my Identity server and API manager but the access token obtained lasts for the default 3600 seconds.I have also tried restarting the servers. Is this approach correct?

1
How do you generate the token?Bee
I do it by sending username and password to Mydomain:9444/oauth2/token. the password type used is grantVinaayakh

1 Answers

1
votes

To change the default expiration time you need to update the value of the tag <UserAccessTokenDefaultValidityPeriod> on identity.xml.

You're running on port 9444 so it probably means you're running both API Manager and Identity Server, so remember to change the correct identity.xml (the one which runs on the port 9444) when you're going to update the value.

You need to restart the server for the change to take effect. Of course that all tokens that were already generated will continue to have the same expiration time, so if you reset the APIM and ask for a token to be generated again it might give you the old token back since it still a valid one.

To make sure you're getting a new token, pass a new scope when calling the token API.