xamarin.auth stuck on success when isUsingNativeUI true

354 Views Asked by At

Im using xamarin.auth for facebook, google and twitter login. Its not closing browser after get success, if i close browser manually IsAuthenticated returning false. If i use isUsingNativeUI false it works fine but very ugly new page with uncontrolled color and title. Is where a way to change color and title on there? I can use these 2 ways too but need to fix.

                var authenticator = new OAuth2Authenticator(
                clientId,                    
                Constants.FacebookScope,
                new Uri(Constants.FacebookAuthorizeUrl),
                new Uri(Constants.FacebookAccessTokenUrl),
                null, isUsingNativeUI: true);

            authenticator.Completed += OnAuthCompleted;
            authenticator.Error += OnAuthError;

            AuthenticationState.Authenticator = authenticator;

            var presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
            presenter.Login(authenticator);

enter image description here

Ugly navigation bar and title

Ugly nav bar

1

There are 1 best solutions below

0
Samet Sığırcı On BEST ANSWER

I just solved my issue with correct redirect url. 111111 means your client Id, add fb on start, ://authorize to the end of it.

        public static string FacebookiOSRedirectUrl = "fb1111111111111://authorize";
        public static string FacebookAndroidRedirectUrl = "fb1111111111111://authorize";

On ios it say unknown or wrong redirect url, you can fix it with add this on your plist.

    <key>CFBundleURLTypes</key>
<array>     
    <dict>
        <key>CFBundleURLName</key>
        <string>Xamarin.Auth facebook PAuth</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb111111111111</string>
        </array>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
    </dict>
</array>