Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,14 @@ private static async Task<DeviceCodeCredential> GetDeviceCodeCredentialAsync(IAu
TokenCachePersistenceOptions = GetTokenCachePersistenceOptions(authContext),
DeviceCodeCallback = (code, cancellation) =>
{
GraphSession.Instance.OutputWriter.WriteObject(code.Message);
try
{
GraphSession.Instance.OutputWriter.WriteObject(code.Message);
}
catch
Comment thread
ramsessanchez marked this conversation as resolved.
Outdated
{
Console.WriteLine(code.Message);
}
return Task.CompletedTask;
}
};
Expand Down Expand Up @@ -277,7 +284,9 @@ private static async Task<IAuthContext> SignInAsync(IAuthContext authContext, Ca
if (authContext is null)
throw new AuthenticationException(ErrorConstants.Message.MissingAuthContext);
var tokenCredential = await GetTokenCredentialAsync(authContext, cancellationToken).ConfigureAwait(false);
var token = await tokenCredential.GetTokenAsync(new TokenRequestContext(GetScopes(authContext)), cancellationToken).ConfigureAwait(false);
// Use isCaeEnabled: true to match the TokenRequestContext that AzureIdentityAccessTokenProvider will use
// during API calls, ensuring MSAL caches a CAE-capable token that can be found silently later.
var token = await tokenCredential.GetTokenAsync(new TokenRequestContext(GetScopes(authContext), isCaeEnabled: true), cancellationToken).ConfigureAwait(false);
Comment thread
ramsessanchez marked this conversation as resolved.
JwtHelpers.DecodeJWT(token.Token, account: null, ref authContext);
return authContext;
}
Expand Down
Loading