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.GetAccessTokenAsync(new AccessTokenRequest { ClientId = GetVariable("AUTH0_CLIENT_ID"), Connection = "google-oauth2", AccessToken = accessToken, Scope = "openid" }); // Then request the delegation token var delegationToken = await authenticationApiClient.GetDelegationTokenAsync(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(); }
public async Task Can_log_in_with_access_token() { var authenticationApiClient = new AuthenticationApiClient(new Uri(GetVariable("AUTH0_AUTHENTICATION_API_URL"))); var token = await authenticationApiClient.GetAccessTokenAsync(new AccessTokenRequest { ClientId = GetVariable("AUTH0_CLIENT_ID"), Connection = "google-oauth2", AccessToken = accessToken, Scope = "openid" }); token.Should().NotBeNull(); token.IdToken.Should().NotBeNull(); token.AccessToken.Should().NotBeNull(); }
public async Task Can_obtain_user_info() { var authenticationApiClient = new AuthenticationApiClient(new Uri(GetVariable("AUTH0_AUTHENTICATION_API_URL"))); // First get the access token var token = await authenticationApiClient.GetAccessTokenAsync(new AccessTokenRequest { ClientId = GetVariable("AUTH0_CLIENT_ID"), Connection = "google-oauth2", AccessToken = accessToken, Scope = "openid" }); // Get the user info var user = await authenticationApiClient.GetUserInfoAsync(token.AccessToken); user.Should().NotBeNull(); user.Email.Should().NotBeNull(); }
public async Task Can_obtain_token_info() { var authenticationApiClient = new AuthenticationApiClient(new Uri(GetVariable("AUTH0_AUTHENTICATION_API_URL"))); // First get the access token var token = await authenticationApiClient.GetAccessTokenAsync(new AccessTokenRequest { ClientId = GetVariable("AUTH0_CLIENT_ID"), Connection = "google-oauth2", AccessToken = accessToken, Scope = "openid" }); // Get the user info var user = await authenticationApiClient.GetTokenInfoAsync(token.IdToken); user.Should().NotBeNull(); user.Email.Should().NotBeNull(); }