Last active
December 5, 2015 19:57
-
-
Save zoint/9e986b76825a8a98dd8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<bool> LoginAsync() | |
{ | |
var authenticator = new Windows.Security.Authentication.OnlineId.OnlineIdAuthenticator(); | |
var mobileServicesTicket = new Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest("https://yourendpoint.azure-mobile.net/", "JWT"); | |
var ticketRequests = new List<OnlineIdServiceTicketRequest>() { mobileServicesTicket }; | |
var authResult = await authenticator.AuthenticateUserAsync(ticketRequests, CredentialPromptType.PromptIfNeeded); | |
if ((authResult.Tickets.Count == 1) && (authResult.Tickets[0].ErrorCode == 0)) | |
{ | |
var accessToken = authResult.Tickets[0]; | |
var res = await _mobileServiceClient.LoginWithMicrosoftAccountAsync(accessToken.Value); | |
return true; | |
} | |
else | |
{ | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment