I am trying to use authentication with RestAssured. Here is my code that does not work:
public static void authenticate(){
RestAssured.baseURI = "https://randomUrl/login";
RequestSpecification request = RestAssured.given().auth().basic("user@google.com", "password123");
Response response = request.get();
System.out.println(response.asString());}
A big reason for which this does not work is that I am missing certain things because when i look at the actual request in postman, there is more info in the tabs there as follows:
Authorization: Basic Auth:
Username:"client"
Password:"pass"
Headers:
Authorization: Basic Y2xpZW50OnBhc3N3b3Jk
Content-Type: application/x-www-form-urlencoded
Body:
username:"user@google.com"
password:"password123"
grant_type:"password"
My question is what are the missing pieces in my code and how do integrate them so that the authorization works?
Thank you