WSO2 API Manager (1.9.0) - Set Expire Date/Validity Time Via cURL

倾然丶 夕夏残阳落幕 提交于 2020-01-25 10:57:20

问题


When using the WSO2 AM via the Store it is possible to set a Validity Time, so that the access token expire time can be increased/decreased.

Is it possible to set the Validity Time via cURL when generating a new token?

E.g. Normal token generation command:

curl -k -d "grant_type=client_credentials" -H "Authorization: Basic userToken, Content-Type: application/x-www-form-urlencoded" localhost:8243/token

{"scope":"am_application_scope default","token_type":"bearer","expires_in":1367,"access_token":"1234456677890"}

Possible token generation command with setting validity time:

curl -k -d "grant_type=client_credentials" -d "validity_time=99999" -H "Authorization: Basic userToken, Content-Type: application/x-www-form-urlencoded" localhost:8243/token

{"scope":"am_application_scope default","token_type":"bearer","expires_in":99999,"access_token":"1234456677890"}

What is the correct command to use for setting this? The reason for this, is because I would like the users of the API Manager be able to set the expire date via a Java API client that we offer.


回答1:


This is not supported out of the box. You can implement it by writing a custom OAuth Grant Type. Please refer [1] for more details on how to write a custom OAuth Grant Type.

[1] https://docs.wso2.com/display/IS500/Writing+a+Custom+OAuth+2.0+Grant+Type



来源:https://stackoverflow.com/questions/31653771/wso2-api-manager-1-9-0-set-expire-date-validity-time-via-curl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!