How to confirm is a user knows the xbox pin in a UWP app?

35 Views Asked by At

How can I confirm that a user is properly authenticated in a UWP app running on Xbox? What I would like to happen is for the system PIN to show and to confirm to my app that the user successfully entered their PIN.

I have included the Microsoft.Xbox.Services library in my project and I tried using this code:


        public async Task<bool> SignInUser()
        {
            try
            {

                Microsoft.Xbox.Services.System.XboxLiveUser user = new XboxLiveUser();
                Microsoft.Xbox.Services.System.SignInResult result = 
                                               await user.SignInAsync(this.Dispatcher);
                return (result.Status == Microsoft.Xbox.Services.System.SignInStatus.Success);

            }
            catch (Exception ex) {

                var message = ex.Message;
                return false;
            
            }
            
           
        }

Unfortunately, this code always crashes the app. What's wrong with my approach?

0

There are 0 best solutions below