xamarin / Xamarin.Auth

Xamarin.Auth
Apache License 2.0
542 stars 350 forks source link

Xamarin Forms iOS showed two pages? #188

Closed SuhanKoh closed 7 years ago

SuhanKoh commented 7 years ago

Xamarin.Auth Issue

When I use Xamarin.Auth with Xamarin.Auth.XamarinForms package, And after I logged in with OAuth2, it does not dismiss the 'root'. The 'root' is a page with back button that is called by Xamarin.Auth.

Version

Steps to reproduce

  1. On ShowLogin, call new Xamarin.Auth.XamarinForms.AuthenticatorPage() and pass in the authenticator.

Expected behaviour

After logged in, the webview should dismissed. Which was the behavior if I do not use Xamarin.Forms and implement it into Xamarin.iOS.

beeradmoore commented 7 years ago

I also have the same issue. Hitting cancel in iOS leaves me at a blank white page (the first of the two pages you mentioned). Hitting back in Android leaves me at a blank white page also, then I can press back again to dismiss this and go back to my original page.

SuhanKoh commented 7 years ago

Hey @ytn3rd , I solved this issue by digging it into the source code.

For Xamarin.Forms.Android, you got to add a similar line like FormsMap, add to MainActivity.cs global::Xamarin.Auth.Presenters.XamarinAndroid.AuthenticationConfiguration.Init(this, bundle);

For Xamarin.Forms.iOS, you got to add [below] in AppDelegate.cs global::Xamarin.Auth.Presenters.XamarinIOS.AuthenticationConfiguration.Init();

Also last but not least, make sure you have Xamarin.Auth.XamarinForms NuGet installed.

beeradmoore commented 7 years ago

Those should be the other way around :P but yeah I see what you mean.

I was also trying to present an AuthenticatorPage but instead I used what the evolve sample did.

 // Presenters Implementation
Xamarin.Auth.Presenters.OAuthLoginPresenter presenter = null;
presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
presenter.Login(authenticator);

Everything seems to work fine. Can you close this issue now @SuhanKoh ?

SuhanKoh commented 7 years ago

@ytn3rd Thanks :P should I close it? I think Xamarin should update their document about this..

beeradmoore commented 7 years ago

Open source project, we should add the new stuff to the README.wd and do a pull request.

Unsure if it belongs in a 1.0 topic on there, or 2.2. The readme.detailed in the wiki has it in under 2.2.

moljac commented 7 years ago

@ytn3rd You are right - it is open source and PRs are welcome.

Xamarin.Forms support contains Presenter[s] and CustomRenderer[s]. Presenters are more tested than CustomRenderers. I have added some fixes to the CustomRenderers, but we moved build system to public jenkins and not everything was setup, so I had to wait.

Fixes are in 1.5.0.1 nuget

https://www.nuget.org/packages/Xamarin.Auth/

Please report if this fixes the CustomRenderers issues.

NOTE: redame.detailed is still under heavy construction (read: mess).

@SuhanKoh

I think Xamarin should update their document about this

On this library Xamarin == {me, myself, I}, so 24:00 hrs day is quite short to fulfil wishes of every user.

Closing is welcome if the problem is fixed. Thanks

SuhanKoh commented 7 years ago

@moljac Understood, I will change readme if it still needed when the customrenderer gets updated.