-
Notifications
You must be signed in to change notification settings - Fork 785
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
Add option to prefer Safari View Controller #325
Conversation
This is useful if you need the customizaition provided by setSafariViewControllerFactory:, or if you need the authorization browser session to be shared with other Safari View Controllers in the app (e.g., for logout).
Codecov Report
@@ Coverage Diff @@
## master #325 +/- ##
==========================================
- Coverage 74.05% 73.93% -0.12%
==========================================
Files 58 58
Lines 5076 5084 +8
==========================================
Hits 3759 3759
- Misses 1317 1325 +8
Continue to review full report at Codecov.
|
You can do this already in AppAuth, see here: #209 (comment) The class in that snippit could be added to AppAuth, but I'm not sure it's needed, as I'm unconvinced that this is a mainstream use-case (but am still open minded if you have some good arguments). Why can't you use logout with Have you tried the |
No, I didn't try the I know that logout would work with There is another argument for adding this flag to the core codebase - the |
So I didn't have the chance to test the |
Yes, logout uses the same external user-agent by default as login.
Good point that this API is confusing now. I think we should probably just remove it. Anyone who needs customizations can still achieve this by providing their own
The flag isn't needed. AppAuth supports pluggable external user-agents, you can drop your preferred one right in (including, for logout). I shared an example SFSafariViewController one that I created. If AppAuth was to include built-in SFSafariViewController support, we could just ship that class directly. For now we don't, but I'll add your use-case to the tally, we might include it if there's enough demand & valid use-cases. Rather than overloading the default user agent
Fair enough. Did you try the code I shared? That will allow you to do this without forking. |
The |
Closing this PR, as the functionality is possible without these changes needed. |
What
This PR adds a static
setPreferSafariViewController:
method toOIDExternalUserAgentIOS
. If set toYES
, the Safari View Controller is used even iOS 11 and 12 whereSFAuthenticationSession
andASWebAuthenticationSession
are normally used.This should fix #209.
Why
We need to implement identity provider logout in an app. This requires us to open a special logout URL in a browser that shared the session (cookies) with the login browser's session. This is trivially possible with Safari View Controller, but not
SFAuthenticationSession
(see #209).