public void TestWithNewCodeVerifier()
        {
            var instance = new AuthorizationCodeGrantArgs();

            instance.WithNewCodeVerifier();
            Assert.That(instance.CodeVerifier, Is.Not.Null.And.Not.Empty);
        }
예제 #2
0
        /// <summary>
        /// Starts the authorization process and waits for the process to complete before returning.
        /// When authorization has been completed, the <see cref="Authorization"/> property is populated
        /// and the access token in <see cref="AuthorizationInfo.AccessTokenResponse"/> is used for the
        /// subsequent API requests.
        /// </summary>
        public virtual void AuthorizeSync()
        {
            var authorization = InitializeAuthorizationCodeGrant();
            var args          = new AuthorizationCodeGrantArgs();

            if (OAuthConfig.UsePkce)
            {
                args = args.WithNewCodeVerifier();
            }
            authorization.AuthorizeSync(args);
            Authorization = authorization;
        }