我正在尝试 Restassured 库来生成不记名身份验证令牌。但是在控制台中获取以下内容,尽管我在标头中使用授权来运行此代码段。有趣的是,为此测试运行状态为 PASSSED 但由于禁止消息仍然无法生成令牌。
{ "message": "Forbidden" }
下面是我试过的代码片段
RestAssured.baseURI="<endpoint URI>";
Response response = RestAssured.given().
contentType("application/x-www-form-urlencoded").
headers("authorization","Basic <String value>
formParam("grant_type", "client_credentials").
formParam("client_id", "<String value>").
formParam("scope", "<String value>").
when().post();
response.prettyPrint();