Kong - oauth2 error when create token

Hello team,

I have a Kong 0.11.x and I’m trying to setup the plugin oauth2.
On ports: 8000/8001

The steps that I’ve been doing are:

  1. Setup a new service:
    POST to /apis
    body:
    {
    “name”: “mock-service”,
    “upstream_url”: “http://mockbin.org/request”,
    “hosts”: “mockbin.org”,
    “methods”: “POST, GET”,
    “uris”: “/mock”
    }

  2. Add plugin oauth2 to the service created:
    POST: /apis/mock-service/plugins
    BODY. {
    “name”: “oauth2”,
    “config.scopes”: [“email”, “phone”, “address”],
    “config.enable_client_credentials”: true,
    “config.mandatory_scope”: true,
    “config.accept_http_if_already_terminated”: true,
    “config.token_expiration”: 7200
    }

  3. Create a consumer
    POST: /consumers
    BODY:
    {
    “username”: “tester”,
    “custom_id”: “tester”
    }

  4. Setup plugin oauth2:
    POST: /consumers/tester/oauth2
    {
    “name”: “mock-service”,
    “redirect_uri”: “http://mockbin.org
    }

– Ok until here —

The nstrong textext steps I understand that is create a token for the consumer,
I do a POST request to: /mock/oauth2/token
BODY:
{
“grant_type”: “authorization_code”,
“client_id”: “”,
“client_secret”: "<CLIENT_SECRET>
“redirect_uri”: “http://mockbin.org
}

I got that error:

{
** “error_description”: “You must use HTTPS”,**
** “error”: “access_denied”**
}


Also, I tried to setup the example app:
https://github.com/Kong/kong-oauth2-hello-world/blob/master/README.md

And I got the error: Invalid client_id

Could anybody give me a hand with that?

Thanks in advance,

JR


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ