Refresh Token in oauth2 plugin


I am a new user of Kong (OSS) and currently trying to create a customer for oauth2 plugin.
Could anyone help me understand that why am I not receving a refresh token along with access token.

oauth2 Configuration as follows:


Command used to retreive the tokens
curl -X POST --url https://localhost:8443/api/v1/process-start/oauth2/token
–data “client_id=CLIENT_ID” \
–data “client_secret=CLIENT_SECRET”
–data “grant_type=client_credentials”
–data “scope=email”
–data “provision_key=PROVISION_KEY” --insecure


Please excuse me for the fomatting and thank you in advance for your time.

Best regards,

client_credential grant does not returns refresh token.

If you need refresh token, try password or authorization code flow instead.

Thank you for your reply. Could you please tell me is it possibe to change the exsiting oauth2 configuration or should I delete everything and start again?
Thank you.
Best regards,

You just need to enable password or authorization code grant of your existing plugin.

Thanks for your reply. I will try the changes. Also, in case of client credentials, once the access token expires what can be done for the consumer so that he gets another access token? I can only think that “token_expiration” parameter must be set to 0 so that the access token never expires. Is there any other way as well?

Thank you in advance
Best regards,

Once it expired, you should request a new access_token.

Client_credential is meant to be used as machine to machine. Getting an access_token should be automated.

Thank you for your answer. Earlier like you said client_credentials does not return refresh token, so how can an access token be generated without it. Because according to the docs, the command needs a previously returned refresh token.

Also how can the process of getting an access_token be automated? Is there a plugin for Kong?

Thanks in advance,

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ