gpt4 book ai didi

java - Postman oAuth2 错误未经授权的授权类型

转载 作者:行者123 更新时间:2023-11-30 07:06:32 25 4
gpt4 key购买 nike

我有一个使用 oAuth2 的应用程序,我尝试使用此命令从终端请求访问 token

curl -X POST -vu clientapp:123456 http://localhost:8080/oauth/token -H "Accept: application/json" -d "password=spring&username=roy&grant_type=password&scope=read%20write&client_secret=123456&client_id=clientapp"

它工作正常,我得到了这样的回复

{"access_token":"29c4c218-1d9a-4d2d-abe3-197bc2969679","token_type":"bearer","refresh_token":"6b7ffda7-4652-4197-b8e9-c80635eb9143","expires_in":38630,"scope":"read write"}

但问题是当我尝试通过 postman 请求访问 token 时总是收到此错误:

Handling error: InvalidClientException, Unauthorized grant type: client_credentials

如何通过 postman 获取访问 token ,就像我通过curl命令获取 token 一样?

最佳答案

检查附件图片,您需要像下面这样通过。

在 header 中,您还需要传递授权 header 。

授权 --> 基本Y2xpZW50OnNlY3JldA==

enter image description here

这对我有用,希望对您有帮助。

关于java - Postman oAuth2 错误未经授权的授权类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40034960/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com