当isUsingNativeUI为真时,xamarin.auth卡在了成功上。

问题描述 投票:0回答:1

我使用xamarin.Auth登录Facebook,谷歌和Twitter。它没有关闭浏览器后获得成功,如果我手动关闭浏览器IsAuthenticated返回false.如果我使用isUsingNativeUI false,它工作正常,但非常丑陋的新页面不受控制的颜色和标题。如果我使用isUsingNativeUI false,它可以正常工作,但非常丑陋的新页面,颜色和标题不受控制。有什么方法可以改变颜色和标题吗?我也可以使用这2种方法,但需要修复。

                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 nav bar

xamarin xamarin.forms xamarin.auth
1个回答
0
投票

我只是解决了我的问题与正确的重定向网址。111111意味着你的客户端ID,添加FB开始,:/授权到它的结束。

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

在ios上,它说未知或错误的重定向网址,你可以修复它与添加这个在你的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>
© www.soinside.com 2019 - 2024. All rights reserved.