Last active
January 17, 2019 17:15
-
-
Save peted70/9819e7cadd1d76eb1e8341c434e137eb 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
res.res = await app.AcquireTokenWithDeviceCodeAsync(scopes, string.Empty, | |
deviceCodeCallback => | |
{ | |
// This will print the message on the console which tells the user where to go sign-in using | |
// a separate browser and the code to enter once they sign in. | |
// The AcquireTokenWithDeviceCodeAsync() method will poll the server after firing this | |
// device code callback to look for the successful login of the user via that browser. | |
// This background polling (whose interval and timeout data is also provided as fields in the | |
// deviceCodeCallback class) will occur until: | |
// * The user has successfully logged in via browser and entered the proper code | |
// * The timeout specified by the server for the lifetime of this code (typically ~15 minutes) has been reached | |
// * The developing application calls the Cancel() method on a CancellationToken sent into the method. | |
// If this occurs, an OperationCanceledException will be thrown (see catch below for more details). | |
UnityEngine.WSA.Application.InvokeOnAppThread(() => | |
{ | |
tempStatusText = deviceCodeCallback.Message; | |
set = true; | |
}, true); | |
return Task.FromResult(0); | |
}, | |
CancellationToken.None).ConfigureAwait(true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment