I am trying to run POST method to get the access token using REST Assured Code. But it is returning 404 error. My code is as below. POSTMAN Configuration as below same trying to replicate using Rest Assured
Method : POST
Authorization tab:
Type : Basic Auth
UserName : ABCD
Passsowrd : Test@1234
Body Tab :
Selecting "application/x-www-form-urlencode" Radio Button
Key : grant_type Value : Client_Credentials
Key : Scope value : ABCDAPI
given().auth().basic("Username Here","Password type here")
.header("Authorization", "Basic T1VUUkVBQ0hfQVBJX0NMSUVOVDpIWmRwREwydkR5UE5iQmtvWEdxSkFpK1Qxa08yWSszNndxQXhoYTVXUWhZPQ==n")
.header("Content-Type","application/x-www-form-urlencoded")
.contentType("application/x-www-form-urlencoded")
.body("[{\"grant_type\":\"client_credentials\"}]")
.body("[{\"scope\":\"ABCDpi\"}]").when()
.post("https://ABCD.KLM.id.XYZ-Cloud.net/oauth2/access_token?realm=PQR")
.then().contentType("").statusCode(200);
I am also attaching the screenshot of Postman where it is working enter image description here