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
13 changes: 13 additions & 0 deletions flutter_appauth/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,19 @@ class _MyAppState extends State<MyApp> {
ExternalUserAgent.sfSafariViewController),
),
),
if (Platform.isIOS)
Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
child: const Text(
'Auto code exchange using system browser (iOS only)',
textAlign: TextAlign.center,
),
onPressed: () => _signInWithAutoCodeExchange(
externalUserAgent:
ExternalUserAgent.customBrowser),
),
),
ElevatedButton(
onPressed: _refreshToken != null ? _refresh : null,
child: const Text('Refresh token'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ @implementation AppAuthIOSAuthorization
return [[OIDExternalUserAgentIOSSafariViewController alloc]
initWithPresentingViewController:rootViewController];
}
if ([externalUserAgent integerValue] == CustomBrowser) {
return [OIDExternalUserAgentIOSCustomBrowser CustomBrowserSafari];
}
return [[OIDExternalUserAgentIOS alloc]
initWithPresentingViewController:rootViewController];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ static NSString *const END_SESSION_ERROR_MESSAGE_FORMAT =
typedef NS_ENUM(NSInteger, ExternalUserAgent) {
ASWebAuthenticationSession,
EphemeralASWebAuthenticationSession,
SafariViewController
SafariViewController,
CustomBrowser
};

@interface AppAuthAuthorization : NSObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,12 @@ enum ExternalUserAgent {
/// Note that as this does not follow the best practices on using the
/// appropriate native APIs based on the OS version, developers should use
/// this at their own discretion.
sfSafariViewController
sfSafariViewController,


/// Indicates a preference for using an external user-agent,
/// suitable for e.g. the secure browser of a MDM solution,
/// SSO flows and using the cookies/context of the system main browser.
/// This is only applicable to iOS (fallback is [asWebAuthenticationSession]).
customBrowser
}
Loading