I'm new to Okta and trying to understand it's Identity Engine library. The scenario I want to achieve is this:
- User logins in once on the first app start
- Next app start we check the cached users credentials to see if their valid, and the user doesn't need to login each time. It invalid we use a refresh token to update the access token
How can I accomplish this? The only Okta sample app (okta-idx-android) does not show how to cache the credentials and instead requires the user to login each time. The library does provide a Credentials wrapper class that does seem to handle caching the token, but if I call any it's functions like credential.introspectToken(TokenType.ACCESS_TOKEN)
or getValidAccessToken()
and the access token is not valid I have no way to restart the InteractionFlow because any attempt to do so gives me an exception "java.lang.IllegalStateException: cookieJar was already accessed, and can't be set." What am I doing wrong? What's another way I can restart the InteractionCodeflow without using the class?