cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2715
Views
0
Helpful
8
Replies

Oauth token expired

jeremypng
Level 4
Level 4

When using the Java SDK, I start the connection and it works fine for a while. But then eventually I get a message like this:

com.cisco.thunderhead.errors.UnauthorizedRestApiException: null: RestApiError with errorType: unAuthorized, errorData: NonBlockingOAuthClient expired token, errorMessage: Oauth token has expired and could not be refreshed

Is there a keepalive method I should be calling to keep the Oauth token from timing out? Or to request a new token?

I haven’t ran across that in the docs.

8 Replies 8

ankparik
Cisco Employee
Cisco Employee

Hi,

While you initialize SDK, SDK should start a thread to renew your OAuth token every hour. Token you get is valid for 2 hors but is refreshed every hour. You should not have to take extra steps for this. Seems like either SDK failed to start refresh thread of refresh token fails.

Did you see this error after 1 hour of using SDK or after 2 hours?

Can you please send more logs so we can do some investigation for this issue?

Thank you

Ankit

logs sent via Spark. Thanks

Was there any result to this analysis? Should I be able to run more than two hours at a time now?

Jeremy,

Sorry for the delay in response. Based on logs, we see that you are trying to use both Context and Management connector from same JVM. This is not supported by Context Service. Each connector needs to be running from separate JVM.

Thank you

Ankit Parikh

Can you ping me to the docs that outline that requirement?

Hi Jeremy,

Please refer to: Cisco DevNet: Context Service - Context Service SDK Guide

You cannot create both a management connection and client connection on the same Java virtual machine.

Thank you

Ankit Parikh

Was that block of text recently added? I don’t remember seeing that before…

Jeremy,

This line was added in the SDK Guide after you raised an issue with expired OAuth token. After debugging, we updated the DOC to indicate that running both connector on same JVM is not supported.

Context team should have reached out to you after our analysis. Again, I am sorry for the delay in response.

Thank you

Ankit Parikh

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: