public String generateBearerToken() {
response = given()
.proxy(configProperties.getProperty("proxy"), Integer.parseInt(configProperties.getProperty("port")))
.proxy(configProperties.getProperty("proxy"), Integer.parseInt(configProperties.getProperty("port")))
.queryParams("client_id", configProperties.getProperty("clientId"))
.queryParams("client_secret", configProperties.getProperty("clientSecret"))
.queryParams("grant_type", configProperties.getProperty("grantType"))
.queryParams("scope", configProperties.getProperty("scope")).when()
.post(configProperties.getProperty("authorizationUrl")).then().extract().response();
bearerToken = utils.getJsonPath(response, "access_token");
return bearerToken;
}
Provide in Property file
clientId=<ID>
clientSecret=<Secret>
grantType=client_credentials
scope=Custom_Scope
authorizationUrl=<URL>/oauth2/default/v1/token
proxy=<proxy>
port=<port>
No comments:
Post a Comment