1
Restricured Webservice automation을 처음 사용했습니다. OAuth2 토큰을 가져 와서 문자열에 저장할 수 있습니다. 그러나이 문자열을 Authorization 헤더에 전달하면 403 오류가 발생합니다.일부 사용자가 작업 코드를 도와 줄 수 있습니까? Authorization 헤더가있는 재발행 된 게시물 요청
작동 코드는 문자열에서 토큰을 저장하려면 작동하지
`String response = given()
.params("grant_type", "XXX", "scope", "XXX")
.auth()
.preemptive()
.basic("XXX","XXX")
.when()
.post("api/path")
.asString();
JsonPath jsonPath = new JsonPath(response);
accessToken = jsonPath.getString("access_token");
String pswd = "Bearer " + accessToken; `
코드는 다음과 같습니다 : 나는 403 오류를 받고 있어요
`given().header("Authorization", pswd)
.body(content).with().contentType("application/json")
.when()
.post("/api/path")
.then().statusCode(200);`
.