尝试使用 Restassured lib 生成承载身份验证令牌时获取禁止消息

问题描述 投票:0回答:0

我正在尝试 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();
authentication rest-assured bearer-token
© www.soinside.com 2019 - 2024. All rights reserved.