Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Xamarin auth and windows phone

$
0
0

Hi,

I built the expreminental branch of xamarin auth for Windows phone.
I created a pagerenderer in my Windows project and manage to get auth.GetUI(). This is of type Uri. I don't knoz zhqt to do with it. I tried the following but NavigationService is null. Does anyone know how I can display that Facebook UI on Windows phone?
Tks.

`protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Page> e)
{
base.OnElementChanged(e);

        var auth = new OAuth2Authenticator(
            clientId: BattleQuiz.App.Instance.OAuthSettings.ClientId, // your OAuth2 client id
            scope: BattleQuiz.App.Instance.OAuthSettings.Scope, // The scopes for the particular API you're accessing. The format for this will vary by API.
            authorizeUrl: new Uri(BattleQuiz.App.Instance.OAuthSettings.AuthorizeUrl), // the auth URL for the service
            redirectUrl: new Uri(BattleQuiz.App.Instance.OAuthSettings.RedirectUrl)); // the redirect URL for the service

        auth.Completed += (sender, eventArgs) =>
        {

            if (eventArgs.IsAuthenticated)
            {
                var acc = eventArgs.Account;
                AccountStore.Create().Save(acc, "Facebook");
                BattleQuiz.App.Instance.ChangeUSer(acc.Username);
                MessagingCenter.Send<BattleQuiz.App>(BattleQuiz.App.Instance, "Authenticated");
            }
            else
            {
                // The user cancelled
            }
        };

        PhoneApplicationPage p = new PhoneApplicationPage();
        this.Children.Add(p);
        Uri uri = auth.GetUI();
        p.NavigationService.Navigate(uri);
    }`

Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>