コード例 #1
0
        /// <summary>
        /// [V3 API] Attempts to acquire an access token for the login hint.
        /// </summary>
        /// <param name="scopes">Scopes requested to access a protected API.</param>
        /// <param name="loginHint">Typically the username, in UPN format, e.g. [email protected]. </param>
        /// <returns>An <see cref="AcquireTokenSilentParameterBuilder"/> used to build the token request, adding optional
        /// parameters.</returns>
        /// <exception cref="AuthUiRequiredException">will be thrown in the case where an interaction is required with the end user of the application,
        /// for instance, if no refresh token was in the cache, or the user needs to consent, or re-sign-in (for instance if the password expired),
        /// or the user needs to perform two factor authentication.</exception>
        public AcquireTokenSilentParameterBuilder AcquireTokenSilent(IEnumerable <string> scopes, string loginHint)
        {
            if (string.IsNullOrWhiteSpace(loginHint))
            {
                throw new ArgumentNullException(nameof(loginHint));
            }

            return(AcquireTokenSilentParameterBuilder.Create(
                       ClientExecutorFactory.CreateClientApplicationBaseExecutor(this),
                       scopes,
                       loginHint));
        }
コード例 #2
0
 /// <inheritdoc />
 public AcquireTokenSilentParameterBuilder AcquireTokenSilent(IEnumerable <string> scopes)
 {
     return(AcquireTokenSilentParameterBuilder.Create(
                ClientExecutorFactory.CreateClientApplicationBaseExecutor(this),
                scopes));
 }