cancel
Showing results for 
Search instead for 
Did you mean: 

How can I check whether the token is expired?

Can4
Explorer
0 Kudos
130

Hi,

I am using sap bo rest services. Before calling the services I must get the logon token. So I am using /logon/long endpoint to get token but I am getting new token in every request so this is a problem. 

I want to get one token and use that token until it expires. So How can I learn how long the token expires? 

If I can learn how many minutes a token is valid for, I can record it in a table and check it. Or does anyone have a different suggestion?

View Entire Topic
ayman_salem
Active Contributor
0 Kudos

Simply send a GET request to check the validity and expiration status.

When the session expires, you will receive error code "FWM 01002" or "FWB 00003" if the login token is no longer valid.

Ex:

GET http://<server>:<port>/biprws/logon/token

Response:
if not yet expired

{
    "logonToken""",
    "tokenType""token"
}
 
if expired:
{
    "error_code""FWM 01002",
    "message""Unable to reconnect to the CMS <cms name>. The session has been logged off or has expired. (FWM 01002)"
}
or no longer valid
{
    "error_code""FWB 00003",
    "message""No valid login token. (FWB 00003)"
}