Oauth Client Credentials

Hi,

Have installed kong on ec2, trying to generate a token.

Have added a oauth plugin to service, My question is how do we generate a token first to get it validated by the plugin which is added in the service.
Have created consumers and client app with clientId and secret.

I’m trying to use this url:

curl --location --request POST ‘http://:8000/oauth/token’
–header ‘Content-Type: application/json’
–data-raw ‘{
“client_id”: “xyz”,
“client_secret”: “123”,
“grant_type”: “client_credentials”
}’

As , i understand /oauth/token is the default path used by kong to generate a token.
Also 8000 is the proxy listen. Tried with 8001 which is admin api, getting 404.

Could any one help or have any suggestions,

First you have to make a proxy route exist. then you have to add the oauth 2 plugin to that route(or the routes underlying service as you said you did). Then you can append the /oauth2/token path to that given route.

Have created other service itself, working now, Thanks!

1 Like