无法在 xamarin android 上使用 OAuth2.0?

Can't use OAuth2.0 on xamarin android?

创建时:

MainActivity (auth.GetUI (this));

Login();

https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=code

我在 nuget 上安装了 xamarin.OAuth。这是代码:

public void Login()
  {
   auth = new OAuth2Authenticator (
    clientId: "3b5a1",
    scope: "",
    authorizeUrl: new Uri ("https://api.instagram.com/oauth/authorize"),
    redirectUrl: new Uri ("http://Instagramcallback.com/callback")
   
   );

   auth.Completed+= (sender, e) => {
    //DismissViewController(true,null);

    if(e.IsAuthenticated)
    {
     
    }
    else
    {
     // errors be showing at here
    }
   };
  }

失败:我没有在屏幕上看到任何弹出窗口。

获得 auth 对象后,您不会显示登录 UI(请参阅下面 link 中的指南):

在 iOS:

PresentViewController (auth.GetUI (), true, null);

(iOS 上的 GetUI 方法 returns UINavigationControllers

在 Android

以下代码显示来自 OnCreate 的 UI:

StartActivity (auth.GetUI (this));

入门:

https://github.com/xamarin/Xamarin.Auth/blob/master/GettingStarted.md