Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# UNRELEASED
- Improved the state validation error messages to distinguish a missing `state` parameter from a mismatched one. The end session message now notes that a provider's `end_session_endpoint` may point at a legacy or SAML single-logout endpoint, which does not echo `state`. Addresses issue #956.
- Fixed `OIDExternalUserAgentIOSCustomBrowser` failing the flow with "Unable to open Safari." when `canOpenURL:` returns `NO` for a URL that the system can open, for example an https URL when Safari is restricted and another browser is the default. The flow now fails only if the URL really cannot be opened. Addresses issue #980.

# 3.0.0
- BREAKING: Updates made to support Xcode 27. ([#972](https://github.com/openid/AppAuth-iOS/pull/972), [#973](https://github.com/openid/AppAuth-iOS/pull/973))
Expand Down
22 changes: 19 additions & 3 deletions Sources/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#import "OIDAuthorizationRequest.h"
#import "OIDAuthorizationService.h"
#import "OIDErrorUtilities.h"
#import "OIDExternalUserAgentSession.h"
#import "OIDURLQueryComponent.h"

#if !TARGET_OS_MACCATALYST
Expand Down Expand Up @@ -153,9 +154,24 @@ - (BOOL)presentExternalUserAgentRequest:(nonnull id<OIDExternalUserAgentRequest>
// Transforms the request URL and opens it.
NSURL *requestURL = [request externalUserAgentRequestURL];
requestURL = _URLTransformation(requestURL);
BOOL willOpen = [[UIApplication sharedApplication] canOpenURL:requestURL];
[[UIApplication sharedApplication] openURL:requestURL options:@{} completionHandler:nil];
return willOpen;
if (!requestURL) {
return NO;
}
// -canOpenURL: is not used to decide whether the request was presented: it is subject to
// LSApplicationQueriesSchemes and can return NO for a URL that
// -openURL:options:completionHandler: opens successfully (e.g. an https URL when Safari is
// unavailable and another browser is the default). The flow fails only if the open really fails.
[[UIApplication sharedApplication] openURL:requestURL
options:@{}
completionHandler:^(BOOL success) {
if (!success) {
NSError *safariError = [OIDErrorUtilities errorWithCode:OIDErrorCodeSafariOpenError
underlyingError:nil
description:@"Unable to open Safari."];
[session failExternalUserAgentFlowWithError:safariError];
}
}];
return YES;
}

- (void)dismissExternalUserAgentAnimated:(BOOL)animated
Expand Down
Loading