2016-09-07 11 views
0

私はXamarin.Androidでアプリケーションを開発しており、ログインシステムが必要でした。したがって私はXamarin.Authを使用しています。私はOAuth2Authenticatorを作成しますが、auth.completedは動作しません。どのように火災のauth.completedに成功した?前の実際の(既存の)エンドポイントと、それを必要とXamarin.Authバージョン1.4.xのにXamarin.Auth未完了

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)); 
      }; 
} 

答えて

0

は、組み込みのWebViewでそれをロードしようとしたので、あなたの問題があった。

redirectUrl: new Uri("ex/callback")

次のようなものを必要としますhttp://somehost.top.level.domain。注:localhostはXamarin.Authのアンダーバージョンでは動作しません。

バージョン1.4.0以降、これらの制限がいくつか削除され、カスタムスキームのredirect_urlが許可されました。

関連する問題