Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No auth configuration available for refresh token #427

Open
ghost opened this issue Nov 7, 2018 · 6 comments
Open

No auth configuration available for refresh token #427

ghost opened this issue Nov 7, 2018 · 6 comments

Comments

@ghost
Copy link

ghost commented Nov 7, 2018

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...

@MytTantely
Copy link

Having the same issue, is this solved?

@ghost
Copy link

ghost commented May 24, 2019

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);

@juanmendez
Copy link

juanmendez commented Feb 7, 2020

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

@juanmendez
Copy link

juanmendez commented Feb 11, 2020

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.

@MKevin3
Copy link

MKevin3 commented Sep 19, 2020

I was missing offlline_access from my scope and adding that solved this for me as well.

@kishansolankiOpenxcell
Copy link

kishansolankiOpenxcell commented Nov 12, 2020

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.

are you talking about setting like this for AuthorizationRequest Builder?
.setScope("offline_access")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants