首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Xamarin.Auth未完成

Xamarin.Auth未完成
EN

Stack Overflow用户
提问于 2016-09-07 16:27:13
回答 1查看 533关注 0票数 0

我正在用Xamarin.Android开发一个应用程序,我需要登录系统。因此,我使用Xamarin.Auth。我创建了一个OAuth2Authenticator,但没有工作的auth.completed。fire auth.completed on是如何成功的?

代码语言:javascript
复制
public void LoginToSabis()
            {
                var auth = new OAuth2Authenticator(
                    clientId: "example_android",
                    scope: "read",
                    authorizeUrl: new Uri("example/authorize"),
                    redirectUrl: new Uri("ex/callback"));

            auth.AllowCancel = true;



        // If authorization succeeds or is canceled, .Completed will be fired. BUT WHEN SUCCEEDS NOT WORKING, WHEN CANCELED WORKING...
        auth.Completed += async (s, ee) =>
        {


            if (!ee.IsAuthenticated)
            {

                var builder = new Android.Support.V7.App.AlertDialog.Builder(this);
                builder.SetMessage("Not Authenticated");
                builder.SetPositiveButton("Ok", (o, e) => { });
                builder.Create().Show();
                return;
            }

            AccountStore.Create(Application.Context).Save(ee.Account, "cg");
            StartActivity(typeof(LoginRedirectActivity));
            };
}
EN

回答 1

Stack Overflow用户

发布于 2017-05-11 16:22:29

在1.4.x之前的版本中,Xamarin.Auth需要真实(现有)端点,并尝试将其加载到嵌入式WebView中,因此您的问题是:

redirectUrl: new Uri("ex/callback")

你需要像http://somehost.top.level.domain这样的东西。注意:本地主机不能与旧版本的Xamarin.Auth一起工作。

从版本1.4.0起,其中一些限制被删除,并允许使用自定义方案的redirect_url。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39364844

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档