gpt4 book ai didi

oauth-2.0 - WSO2 API Manager 客户端凭据更新 token

转载 作者:行者123 更新时间:2023-12-02 23:19:01 25 4
gpt4 key购买 nike

我正在尝试续订通过 API Manager 生成的 token 。

生成 token 的curl语句是:

curl -k -d "grant_type=client_credentials" -H "Authorization: Basic TDQ0SktDZm5DcVVDSVBjdGYwVDIyRWwwUGY4YT
o2d19NQm9xYnBFXzRLNHR0Wkc0NXhxd0NMTDRh , Content-Type: application/x-www-form-urlencoded" https://10.108.106.214:8250/token

响应是

"scope":"am_application_scope default","token_type":"bearer","expires_in":1094,"access_token":"6d1d0f8afbd147d24bcd42bbc5361a1"

根据文档,它应该生成一个未生成的重新 token 。我错过了什么?

当我将 grant_type 作为刷新 token 传递时。我收到无效授权错误。

curl -X POST -H "Authorization: Basic TDQ0SktDZm5DcVVDSVBjdGYwVDIyRWwwUGY4YTo2d19NQm9xYnBFXzRLNHR0Wkc0NXhxd0NMTDRh"  -H "Content-Type: application/x-www-form-urlencoded" -d 'grant_type=refresh_token&refresh_token=6d1d0f8afbd147d24bcd42bbc5361a1' 'https://10.108.106.214:8250/token'

我指的是URL中的文档 https://docs.wso2.com/display/AM191/Token+API#TokenAPI-RenewingaccesstokensRenewing

那么我错过了什么?

最佳答案

根据OAuth 2.0 Authorization Protocol规范中,grant_type client_credentials 不应发出刷新 token 。

4.4.3. Access Token Response

If the access token request is valid and authorized, the authorizationserver issues an access token as described in Section 5.1. A refreshtoken SHOULD NOT be included.

您必须使用Password Grant Type

请求:

curl -k -d "grant_type=password&username=admin&password=admin" -H "Authorization: Basic bkxidjNPTnYxQ25iTXBRY2E3V3hPajdaMUVZYTpuTUQzX0tKQkhGRmxFUUlXdllmSjdTUFlleThh, Content-Type: application/x-www-form-urlencoded" https://localhost:8243/token

回应:

{"scope":"default","token_type":"bearer","expires_in":3247,"refresh_token":"91729a78a96b58d80d869f3ec2ce8b8","access_token":"ec54b39dd9503c9f65df84b67ea586"}

使用refresh_tokenRenewing access tokens

关于oauth-2.0 - WSO2 API Manager 客户端凭据更新 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33400193/

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