[#574] Return errors from AppAuth:ResumeExternalUserAgentFlowWithURL#955
Open
[#574] Return errors from AppAuth:ResumeExternalUserAgentFlowWithURL#955
Conversation
…thorizationFlow error codes
…ocol, deprecate old method
…n OIDAuthorizationSession
…n OIDEndSessionImplementation
…n redirect handler
…ithURL: shims The shims forward to the new error-returning variant for backward compatibility; their callers see the deprecation, but the shim itself must compile cleanly under -Werror.
…ange The deprecated resumeExternalUserAgentFlowWithURL: now silently returns NO on invalid state instead of raising NSException. Spell that out so callers relying on @try/@catch around the old API aren't surprised.
… API The new SwiftUI/SPM sample (added in #952) was using the deprecated resumeExternalUserAgentFlow(with:); update it to use the throwing variant, mirroring the Carthage Swift sample.
Spell out both NO cases (URLMismatch + InvalidAuthorizationFlow) on the new :error: method so callers know what NO can mean.
…acing string
OIDOAuthExceptionInvalidAuthorizationFlow is exception-prose, not error prose.
Use a clean inline localizedDescription at both call sites instead. The
constant remains in OIDError.{h,m} for backward compatibility.
…zationFlow
The previous wording ("may have already completed or was not started") was
speculative. Describe the actual trigger: the redirect URL was received but
no pending callback exists.
…ples The previous snippets logged every error from resumeExternalUserAgentFlowWithURL:error:, which is noisy because OIDErrorCodeURLMismatch fires on every unrelated deeplink. Only log on OIDErrorCodeInvalidAuthorizationFlow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Asserts are Bad Bad Not Good(TM). This PR deprecates the extant method and points developers to a new edition which returns errors rather than crashing with asserts.
Two cases are handled:
shouldHandleURLis false, the function returnsNOand sets an error._pendingEndSessionCallbackisnil, the function now returns an error.