[英]WSO2 API Manager Client Credentials renew token
I am trying to renew the token generated through API Manager. 我正在尝试续订通过API Manager生成的令牌。
The curl statement for generate token is: 生成令牌的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
The response is 回应是
"scope":"am_application_scope default","token_type":"bearer","expires_in":1094,"access_token":"6d1d0f8afbd147d24bcd42bbc5361a1"
Based on the documentation it is supposed to generate a retoken which is not being genarated. 根据文档,它应该生成一个不被生成的retoken。 What am I missing?
我错过了什么?
Also when I pass the grant_type as refresh_token. 当我将grant_type作为refresh_token传递时。 I get a invalid grant error.
我收到了无效的授权错误。
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'
I am referring to the documentation in the URL https://docs.wso2.com/display/AM191/Token+API#TokenAPI-RenewingaccesstokensRenewing 我指的是网址https://docs.wso2.com/display/AM191/Token+API#TokenAPI-RenewingaccesstokensRenewing中的文档
So what am I missing? 那我错过了什么?
According to the OAuth 2.0 Authorization Protocol specification, grant_type client_credentials should not issue refresh token. 根据OAuth 2.0授权协议规范,grant_type client_credentials不应发出刷新令牌。
4.4.3.
4.4.3。 Access Token Response
访问令牌响应
If the access token request is valid and authorized, the authorization server issues an access token as described in Section 5.1.
如果访问令牌请求有效且已获得授权,则授权服务器会发出访问令牌,如第5.1节所述。 A refresh token SHOULD NOT be included.
刷新令牌不应该包括在内。
You have to use Password Grant Type 您必须使用密码授予类型
Request : 要求:
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
Response : 回应:
{"scope":"default","token_type":"bearer","expires_in":3247,"refresh_token":"91729a78a96b58d80d869f3ec2ce8b8","access_token":"ec54b39dd9503c9f65df84b67ea586"}
Use the refresh_token
to Renewing access tokens 使用
refresh_token
更新访问令牌
If i am not mistaken, in the response you have received. 如果我没有记错的话,在你收到的回复中。
"scope":"am_application_scope default","token_type":"bearer","expires_in":1094,"access_token":"6d1d0f8afbd147d24bcd42bbc5361a1"
This is the new access token. 这是新的访问令牌。
access_token":"6d1d0f8afbd147d24bcd42bbc5361a1"
Take note of the current token, then run the curl command again. 记下当前令牌,然后再次运行curl命令。 The response should be a different token.
响应应该是不同的标记。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.