【发布时间】:2021-06-03 10:53:52
【问题描述】:
我在 InteliJ/Java/RestAssured 中的 POST 请求中收到 400 错误,但在 Postman 中没有,所以谁能告诉我哪里出错了 第一邮递员
Endpoint: https://xxxxxx.auth.us-east-2.amazoncognito.com/oauth2/token
我的身体参数是
client_id anvalidid
client_secret shhhhitisasecret
scope https://xxxxxx.auth.us-east-2.amazoncognito.com/read
grant_type client_credentials
现在,当我发布此消息时,我会收到 200 响应和一个不错的新访问令牌。 当我在 Java/RestAssured 中尝试相同的操作时,我收到 400 bad request 错误,这就是我发布的内容。
Endpoint: https://xxxxxx.auth.us-east-2.amazoncognito.com/oauth2/token
身体
{
"client_id":"anvalidid",
"client_secret":"shhhhitisasecret",
"scope":"https://xxxxxx.auth.us-east-2.amazoncognito.com/read",
"grant_type":"client_credentials"
}
Header: "Content-Type", "application/x-www-form-urlencoded"
每次我运行它都会收到 HTTP/1.1 400 Bad Request 错误,我不知道为什么。 谁能看到我要去哪里错了。 提前致谢。
以下是返回的标头
Date=Thu, 03 Jun 2021 10:45:55 GMT
Content-Type=application/json;charset=UTF-8
Transfer-Encoding=chunked
Connection=keep-alive
Set-Cookie=XSRF-TOKEN=093edd16-255e-42ad-9f11-be84cd56c5dc; Path=/; Secure; HttpOnly; SameSite=Lax
x-amz-cognito-request-id=4c91be06-9d0b-47d9-997e-f292eee61650
X-Application-Context=application:prod:8443
X-Content-Type-Options=nosniff
X-XSS-Protection=1; mode=block
Cache-Control=no-cache, no-store, max-age=0, must-revalidate
Pragma=no-cache
Expires=0
Strict-Transport-Security=max-age=31536000 ; includeSubDomains
X-Frame-Options=DENY
Server=Server
还有饼干
XSRF-TOKEN=093edd16-255e-42ad-9f11-be84cd56c5dc;Path=/;Secure;HttpOnly
【问题讨论】:
标签: java postman rest-assured