Showing results for 
Search instead for 
Did you mean: 

SAP BTP CF - Can't access "expires_in" variable after OAuth v2.0 call in API

0 Kudos

We have created an API to create an Auth Token. The policy we use is OAuth V2.0. After the OauthV2.0 call we then call an Assign Message policy so that we only return the "access_token" and none of the other info sensitive variables eg. "".

<!-- This policy can be used to create or modify the standard HTTP request and response messages -->

<AssignMessage async="false" continueOnError="false" enabled="true" xmlns=''>

<!-- Sets a new value to the existing parameter -->


<Payload contentType="application/json" variablePrefix="@" variableSuffix="#">




<AssignTo createNew="false" type="response">response</AssignTo>


The above works great and we only get the "access_token" variable returning to the API Call.

We have asked by business to return the "expires_in" variable also. I have changed to Assign Message policy to return "expires_in" but I am getting an "unresolved variable" error when calling the API. I have tried both @apigee.expires_in# and @expires_in# , both don't work!

If I debug the API i can't see the EXPIRES_IN variable.

But if I remove the ASSIGN_MESSAGE policy I get everything returned to the API call , including expires_in. eg.


"refresh_token_expires_in": "0",

"api_product_list": "[ArticleInfoProduct, CCMenuProduct, CCOrderProduct]",

"api_product_list_json": [





"organization_name": plc-01",


"token_type": "BearerToken",

"issued_at": "1698225325409",

"client_id": "12345678912346678",

"access_token": "pqTkCPGyHM3Z64QyDM9YCFtNfEYr",

"application_name": "97516f7a-4ca3-48f7-9b57-8360hfjjfjfjfjfkfkfk3",

"scope": "",

"expires_in": "1799",

"refresh_count": "0",

"status": "approved"


How can I return the "expires_in" variable alongside the "Access_token" to the API call?

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

We used an Extract Variable policy to access the variable.

Active Contributor
0 Kudos

Hello Darren,

Below might help you .Before you set you must retrieve the data using Extract variables and then assign those using AssignMessage policy.Also please paste screenshot of your policy that might help to give more suitable solution.


Sriprasad Shivaram Bhat

0 Kudos

Thanks for your reply. It helped us with the solution to our problem.