403 Forbidden | Access Token

Hi,

I’m trying to generate an access_token using the password/client_credentials grant type, but I’m receiving “403 Forbidden”

{
“message”: “You cannot consume this service”
}

for the request,
curl --location --request POST ‘https://localhost:8443/mock/oauth2/token
–header ‘host: mockbin.org
–header ‘Authorization: Basic {client_id:client_secret}’
–header ‘Content-Type: application/x-www-form-urlencoded’
–data-urlencode ‘grant_type=password’
–data-urlencode ‘client_id={client_id}’
–data-urlencode ‘client_secret={client_secret}’
–data-urlencode ‘provision-key=oqmya7bq4vJ1QWuWMHjaF6k6KsH3E4oG’
–data-urlencode ‘scope=read’
–data-urlencode ‘authenticated_userid=oauth-consumer’

I have tried using client_credentials grant_type as well but getting the same response.

Thanks
Any Response would much be appreciated.

First thing that I’m seeing in your request is that you’re using Basic Authorization which might be wrong

I guess below could be the right one

–header ‘Authorization: Bearer {client_id:client_secret}’

Moreover, I suggest to use JWT plugin instead


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ