cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1618
Views
20
Helpful
2
Replies

Refresh REST token for authentication

chad_meyer
Level 1
Level 1

Hey everyone.  I am developing a CVP 11.6 application that needs to authenticate a REST API.  The token is only valid for a short time before needing to be regenerated.  While I am able to check for a 401 and POST credentials to generate a new token I am wondering if there is a way to have the app store that new token for subsequent calls.  If not, would it be possible to store the new value back in ICM and have new calls use the value from there (unlikely, I assume) or would it need to be stored elsewhere (database?) and then pulled in?  Any guidance would be appreciated.

1 Accepted Solution

Accepted Solutions

You could certainly pass the information back to ICM, write it in a global variable for all future calls to use that gets passed into your CVP application. Then, when your information needs to get refreshed again, have that global variable be overwritten in ICM with the new value. Basically, have a check in ICM when the cal comes out of your application on whether that global variable needs to be updated.

View solution in original post

2 Replies 2

ptindall
Cisco Employee
Cisco Employee

If you want to persist data across sessions you can store it in Application or Global data depending on the scope you need.  It's just a Java object that is stored so very flexible although you will have to use the API and a custom element to store and retrieve.  For convenience, there's some custom elements here for handling common data -- you can use as is or as an example for building your own.

You could certainly pass the information back to ICM, write it in a global variable for all future calls to use that gets passed into your CVP application. Then, when your information needs to get refreshed again, have that global variable be overwritten in ICM with the new value. Basically, have a check in ICM when the cal comes out of your application on whether that global variable needs to be updated.