Skip to content

Commit

Permalink
Don't fail auth flow if the url doesn't contain the code query parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
XanderZhu committed Jul 25, 2023
1 parent ee784d2 commit 5625cf3
Showing 1 changed file with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,23 @@ class AuthSocialWebViewClient(
request?.url?.let { url ->
val urlString = url.toString()
if (urlString.startsWith("https://${networkEndpointConfigInfo.host}/oauth?")) {
val message = try {
val codeQueryParameter = url.getQueryParameter(CodeParameter)
if (codeQueryParameter != null) {
AuthSocialWebViewFeature.Message.AuthCodeSuccess(
codeQueryParameter,
socialAuthProvider
try {
url.getQueryParameter(CodeParameter)?.let { codeQueryParameter ->
onNewMessage(
AuthSocialWebViewFeature.Message.AuthCodeSuccess(
codeQueryParameter,
socialAuthProvider
)
)
} else {
}
} catch (e: UnsupportedOperationException) {
onNewMessage(
AuthSocialWebViewFeature.Message.AuthCodeFailure(
socialError = AuthSocialError.CONNECTION_PROBLEM,
originalError = IllegalStateException("No code query parameter in url")
originalError = e
)
}
} catch (e: UnsupportedOperationException) {
AuthSocialWebViewFeature.Message.AuthCodeFailure(
socialError = AuthSocialError.CONNECTION_PROBLEM,
originalError = e
)
}
onNewMessage(message)
}
}
return false
Expand Down

0 comments on commit 5625cf3

Please sign in to comment.