【问题标题】:MobileServiceAuthenticationProvider.MicrosoftAccount,token<-????) from where can I get tokenMobileServiceAuthenticationProvider.MicrosoftAccount,token<-????) 从哪里可以获得令牌
【发布时间】:2017-03-30 12:22:45
【问题描述】:

我正在尝试为连接到 Azure 移动后端服务的移动应用程序实施 Microsoft 身份验证,我创建了一个 MobileServiceUser 用户;然后我尝试使用方法 LoginAsync 并且已经选择了 Micorosft Provider,问题是我从哪里可以获得令牌值

user = await App.Client.LoginAsync(MobileServiceAuthenticationProvider.MicrosoftAccount,token

我尝试获取有关此的信息

谢谢

【问题讨论】:

    标签: azure


    【解决方案1】:

    不确定您是否曾经得到过这个问题的答案,但您从客户端管理的身份验证中获得了令牌。您独立使用每个提供程序 API(Facebook、Google、Microsoft、LinkedIn 等),然后当您使用 OAuth 对其进行身份验证时,您将获得一个令牌。然后将令牌传递给 LoginAsync 调用。

    这里有一些示例代码:

                        auth = new OAuth2Authenticator(
                 clientId: "MyAppId",  // For Facebook login, for configure refer http://www.c-sharpcorner.com/article/register-identity-provider-for-new-oauth-application/
                 scope: "",
                 authorizeUrl: new Uri("https://m.facebook.com/dialog/oauth/"), // These values do not need changing
                 redirectUrl: new Uri("http://www.facebook.com/connect/login_success.html")// These values do not need changing
    
    // After facebook,google and all identity provider login completed 
                        auth.Completed += Auth_Completed;
    
        private async void Auth_Completed(object sender, Xamarin.Auth.AuthenticatorCompletedEventArgs e)
        {
            if (e.IsAuthenticated)
            {
    
    string token = e.Account.Properties["access_token"];
               }
        }
    

    然后您在 LoginAsync 方法中传递此令牌。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-15
      • 2020-11-01
      • 2018-04-09
      • 1970-01-01
      • 2021-12-25
      • 1970-01-01
      • 2013-02-13
      • 2013-04-05
      相关资源
      最近更新 更多