Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string authority = "https://xxxx/adfs/oauth2";
- const bool useCorporateNetwork = true;
- var authContext = new AuthenticationContext(authority, false);
- var authResult = await authContext.AcquireTokenAsync(resourceURI, clientID, new Uri(clientReturnURI), new PlatformParameters(PromptBehavior.Auto, useCorporateNetwork));
- AuthenticationContext ac = new AuthenticationContext(authority);
- AuthenticationResult result=null;
- try
- {
- result = await ac.AcquireTokenSilentAsync(resource, clientId);
- }
- catch (AdalException adalException)
- {
- if (adalException.ErrorCode == AdalError.FailedToAcquireTokenSilently
- || adalException.ErrorCode == AdalError.InteractionRequired)
- {
- result = await ac.AcquireTokenAsync(resource, clientId, redirectUri,
- new PlatformParameters(PromptBehavior.Auto));
- }
- }
Add Comment
Please, Sign In to add comment