Unable to show OAuth Login from Xamarin.Forms modal Page
See original GitHub issueXamarin.Auth Issue
Version
- component version = 1.7.0
Steps to reproduce
- Open a Xamarin.Forms modal page
- Create an
OAuth2Authenticator
- Create an
OAuthLoginPresenter
- Call
OAuthLoginPresenter.Login
from the modal page
I’ve attached a MCVE that reproduces the issue:
Platform:
- .NET Standard 2.0
- mono 6.6
- iOS 13.1.2
- Xamarin.iOS 13.8.1.1 (Preview)
- Xcode 11.1
- Visual Studio 16.4 (Preview 2)
(I am using the Visual Studio 16.4 P2 because debugging failed with 16.3, but the issue occurred when using 16.3 with Xamarin.iOS 13.2 and mono 6.0, too)
Expected behaviour
The application should show the OAuth login page to authenticate the user with the app.
Actual behaviour
The web view is not shown and a warning is displayed on the debug output
Warning: Attempt to present <SFSafariViewController: 0x10aa65600> on <Xamarin_Forms_Platform_iOS_PlatformRenderer: 0x10725f950> whose view is not in the window hierarchy!
Issue Analytics
- State:
- Created 4 years ago
- Comments:8
Top Results From Across the Web
Unable to show OAuth Login from Xamarin.Forms modal Page
Open a Xamarin.Forms modal page · Create an OAuth2Authenticator · Create an OAuthLoginPresenter · Call OAuthLoginPresenter.Login from the modal page.
Read more >ios - Unable to redirect to the authentication page using ...
Now I am using the OAuth2.0 for login functionality. So I have created one view controller in Xamarin iOS project. In the AppDelegate...
Read more >Xamarin.Forms Modal Pages
Xamarin.Forms provides support for modal pages. A modal page encourages users to complete a self-contained task that cannot be navigated ...
Read more >Build Login in Xamarin with Xamarin.Forms
Learn to build a cross-platform login form for iOS, Android, and Windows using Xamarin Forms.
Read more >Implementing User Authentication with Sign in with Apple
In the sample app, LoginViewController displays a login form and a Sign in with Apple button ( ASAuthorizationAppleIDButton ) in its view hierarchy....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I experienced a similar problem, but with another warning. The problem originated in the Presenter choosing the wrong ViewController. Fortunately I was able to inject my own Presenter:
and in AppDelegate I changed:
Currently I still have a error dialog popping up (cannot open URL), but authentication works. I will post an update as soon as I got rid of the error dialog.
UPDATE The “Cannot open URL”-error dialog was due to a configuration error (wrong URL scheme in info.plist).
Yes @AlexSchuetz thank you for the insight. I might have to step back and rethink this a bit here.