/// <summary> /// Interactively authenticates a user via the default browser. /// </summary> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> /// <returns>The <see cref="AuthenticationRecord"/> which can be used to silently authenticate the account on future execution of credentials using the same persisted token cache.</returns> public virtual async Task <AuthenticationRecord> AuthenticateAsync(CancellationToken cancellationToken = default) { // get the default scope for the authority, throw if no default scope exists string defaultScope = AzureAuthorityHosts.GetDefaultScope(Pipeline.AuthorityHost) ?? throw new CredentialUnavailableException(NoDefaultScopeMessage); return(await AuthenticateAsync(new TokenRequestContext(new string[] { defaultScope }), cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Interactively authenticates a user via the default browser. /// </summary> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> /// <returns>The result of the authentication request, containing the acquired <see cref="AccessToken"/>, and the <see cref="AuthenticationRecord"/> which can be used to silently authenticate the account.</returns> public virtual AuthenticationRecord Authenticate(CancellationToken cancellationToken = default) { // get the default scope for the authority, throw if no default scope exists string defaultScope = AzureAuthorityHosts.GetDefaultScope(_pipeline.AuthorityHost) ?? throw new CredentialUnavailableException(NoDefaultScopeMessage); return(Authenticate(new TokenRequestContext(new string[] { defaultScope }), cancellationToken)); }