私はXamarin.Authを使い始めました。私はoauthを介してFacebookのログインを有効にしたいと思います。ここでXamarin.Auth:Facebookのoauthを使用して、私のアプリケーションにリダイレクトする方法は?
は私の設定です:
public static string ClientId = "client id";
public static string ClientSecret = "client secret";
public static string Scope = "email";
public static string AuthorizeUrl = "https://m.facebook.com/dialog/oauth";
public static string RedirectUrl = "https://www.facebook.com/connect/login_success.html";
public static string AccessTokenUrl = "https://m.facebook.com/dialog/oauth/token";
コード認証を開始するために:
public class AuthenticationPageRenderer : PageRenderer
{
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear (animated);
var auth = new OAuth2Authenticator (
Constants.ClientId,
Constants.ClientSecret,
Constants.Scope,
new Uri (Constants.AuthorizeUrl),
new Uri (Constants.RedirectUrl),
new Uri (Constants.AccessTokenUrl)
);
auth.Completed += OnAuthenticationCompleted;
PresentViewController (auth.GetUI(), true, null);
}
async void OnAuthenticationCompleted (object sender, AuthenticatorCompletedEventArgs e)
{
Debug.WriteLine ("AUTH Completed!");
if (e.IsAuthenticated) {
}
}
}
が正常に動作するようですが、代わりにhttps://www.facebook.com/connect/login_success.htmlにユーザーをリダイレクトする、私は戻って彼をリダイレクトします私のアプリをもう一度。どんな助けも大変ありがとう!
ベスト、 サシャ
なぜredirectionURLとしてhttps://www.facebook.com/connect/login_success.htmlを提供していますか? redirectionURLはアプリのURLでなければなりません。 – sameer