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

Handling authority server errors with custom login screen. #238

Open
emrsn-SebastianVancea opened this issue Oct 30, 2017 · 2 comments
Open

Comments

@emrsn-SebastianVancea
Copy link

emrsn-SebastianVancea commented Oct 30, 2017

I am trying to handle 400 (invalid_grant, i.e. we deleted the refresh_token to force a logout for some users) and 500 errors from our custom authority server.

However, as it is right now in OAuth2.swift:196, doRefreshToken returns with callback(nil) in these cases and so it will always try show the Login screen (registerClientIfNeeded) instead of allowing me to just show a 'Try later' error.

Another side of this is in OAuth2.swift:358 it will throw an error if there is an invalid_grant, but it will set the refreshToken to nil if there was a 500.

Am I missing something and I should just write my own OAuth2 subclass? In this case I would probably need to override the OAuth2DataLoader as well since right now OAuth2.authorize is final

@p2
Copy link
Owner

p2 commented Nov 2, 2017

There have recently been some changes there, have you seen them? In tryToObtainAccessTokenIfNeeded it will now return the error in the callback (except if it's a 401). This should result in didFail being called in your case, is this not the case?

You're right about the 500 issue in doRefreshToken; happy to review a PR that doesn't delete the token on 500s! :)

@KimKellerRasmussen
Copy link

When will this be implemented ?

Refresh token should not be cleared if connection is missing or is lost; unavailable, timeout, ... etc.

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

3 participants