No auth configuration available for refresh token
When i use the method performActionWithFreshTokens after the auth flow completion, and after the access_token is expired, I receive:
java.lang.IllegalStateException: No authorization configuration available for refresh request
What could be gone wrong? Parsing the response? I've saved the authState json previously, but I don't see any lastAuthorizationResponse key...
Having the same issue, is this solved?
I am not sure if this is the right solution, but this may help.
final AuthorizationResponse response = new AuthorizationResponse.Builder(authRequest)
.fromUri(uri)
.build();
authState.update(authorizationResponse, null);
prior to saving your authState json, ensure you have updated the authState with an authenticationResponse and also with tokenResponse
// this is following the activity result
authState.update(authorizationResponse, ex)
// this comes following authService.performTokenRequest(request)
authState.update(tokenResponse, ex)
// so add a breakpoint, when you get here and see if your authState has both responses
yourStoringFunctionality( authState.jsonSerializeString() )
// now when you need to refresh, first time just check if everything is in sync with the responses stored
val lastState = AuthState.jsonDeserialize(authStateJson)
lastState.performActionWithRefreshTokens( authService, clientSecretIfApplies, handler )
after your handler gets new accessToken, and idToken, your authState is automatically updated with those tokens, and there is no need to invoke update method again. Now you need to store it such as done above yourStoringFunctionality( authState.jsonSerializeString() ).
I have to say that the documentation is not very extended in how to do this
This is quite helpful, if you see no refresh-token being provided either the first time tokens are generated or when they are refreshed, make sure to include offline_access to your scope This is the way it worked for me.
I was missing offlline_access from my scope and adding that solved this for me as well.
This is quite helpful, if you see no refresh-token being provided either the first time tokens are generated or when they are refreshed, make sure to include
offline_accessto your scope This is the way it worked for me.
are you talking about setting like this for AuthorizationRequest Builder?
.setScope("offline_access")