예제 #1
0
        public async Task Can_get_delegation_token()
        {
            var authenticationApiClient = new AuthenticationApiClient(new Uri(GetVariable("AUTH0_AUTHENTICATION_API_URL")));
            
            // First get the access token
            var token = await authenticationApiClient.GetAccessToken(new AccessTokenRequest
            {
                ClientId = GetVariable("AUTH0_CLIENT_ID"),
                Connection = "google-oauth2",
                AccessToken = accessToken,
                Scope = "openid"
            });

            // Then request the delegation token
            var delegationToken = await authenticationApiClient.GetDelegationToken(new IdTokenDelegationRequest(
                GetVariable("AUTH0_CLIENT_ID"),
                GetVariable("AUTH0_CLIENT_ID"),
                token.IdToken)
            {
                Scope = "openid",
                GrantType = "urn:ietf:params:oauth:grant-type:jwt-bearer",
                ApiType = "app"
            });

            delegationToken.Should().NotBeNull();
            delegationToken.IdToken.Should().NotBeNull();
        }