cancel
Showing results for 
Search instead for 
Did you mean: 

How do I change the expires_in value for an authentication token ?

0 Kudos

Hi All,

I tried following all the steps in the blog whose URL is mentioned below.

https://blogs.sap.com/2019/04/29/sap-cloud-platform-backend-service-tutorial-13-api-called-from-exte...

While I am getting the authentication token and the entire flow is running properly, I just cannot change the value of expires_in which is 43199 by default.

How do I change that to some other value, let's say 5 minutes (300 seconds) ?

Accepted Solutions (0)

Answers (1)

Answers (1)

CarlosRoggan
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello souvik_majumder ,

The value of expires_in can be controlled via configuration of the XSUAA instance:
When you create the instance of XSUAA service, you pass a couple of parameters in JSON format, right? Here you can add one parameter for the oauth configuration, which in turn contains one parameter for the validity of the access token (and also for the refresh token):

   "oauth2-configuration": {
      "token-validity": 7200
   }

I've described it a bit here:
https://blogs.sap.com/2019/05/09/sap-cloud-platform-backend-service-tutorial-15-security-using-autho...

and the reference of the parameters of XSUAA configuration can be found in the SAP Help Portal

Hope this answers your question,

Kind Regards,
Carlos



0 Kudos

Thanks Carlos,

It worked for me. I did add the parameter in the xs-security.json file. The only mistake I did, is that I didn't mention the xs-security.json path in the cf update command. It should be like the one below.

cf update-service <uaa_instance_name> -c <json_file | inline-JSON object>

Eg:

cf update-service my-xsuaa -c xs-security.json

The command should be run from the path where the above json file is present.