diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceClientCredentialTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceClientCredentialTestCase.java index c746736debf..5b810f82a46 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceClientCredentialTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceClientCredentialTestCase.java @@ -133,7 +133,10 @@ public void testGetTokenUsingClientCredentialsGrant() throws Exception { ClientID clientID = new ClientID(consumerKey); Secret clientSecret = new Secret(consumerSecret); ClientAuthentication clientAuth = new ClientSecretBasic(clientID, clientSecret); - Scope scope = new Scope(OAUTH2_SCOPE_OPENID, "xyz"); + + // Add email, profile scopes to the request. + Scope scope = new Scope(OAuth2Constant.OAUTH2_SCOPE_OPENID, OAuth2Constant.OAUTH2_SCOPE_EMAIL, + OAuth2Constant.OAUTH2_SCOPE_PROFILE, "xyz"); URI tokenEndpoint = new URI(OAuth2Constant.ACCESS_TOKEN_ENDPOINT); TokenRequest request = new TokenRequest(tokenEndpoint, clientAuth, clientCredentialsGrant, scope); @@ -154,9 +157,15 @@ public void testGetTokenUsingClientCredentialsGrant() throws Exception { Assert.assertTrue(scopesInResponse.contains("xyz"), "Requested scope is missing in the token response"); // This ensures that openid scopes are not issued for client credential grant type. - Assert.assertFalse(accessTokenResponse instanceof OIDCTokenResponse, "Client credential grant type cannot " + - "get a OIDC Token Response."); - Assert.assertFalse(scopesInResponse.contains(OAUTH2_SCOPE_OPENID), "Client credentials cannot get openid scope."); + Assert.assertFalse(accessTokenResponse instanceof OIDCTokenResponse, + "Client credential grant type cannot get a OIDC Token Response."); + Assert.assertFalse(scopesInResponse.contains(OAUTH2_SCOPE_OPENID), + "Client credentials cannot get openid scope."); + + Assert.assertFalse(scopesInResponse.contains(OAuth2Constant.OAUTH2_SCOPE_EMAIL), + "Client credentials cannot get email scope."); + Assert.assertFalse(scopesInResponse.contains(OAuth2Constant.OAUTH2_SCOPE_PROFILE), + "Client credentials cannot get profile scope."); } @Test(groups = "wso2.is", description = "Validate access token",