Proper URL to retrieve the access token with edgemicro-oauth proxy

Hello All,

I've been trying to get the access token via curl URL with no success (with edgemicro cli I was able to get it done correctly though).

I was using the URL provided in the documentation tutorial:

http://docs.apigee.com/microgateway/latest/edge-microgateway-tutorial (Part 4)

curl -i -X POST "http://<org>-<env>.apigee.net/edgemicro-auth/token" -d '{"grant_type": "client_credentials", "client_id": "4t8X137pOUUtMR7wag3M1yZTcRxeK", "client_secret": "RAcOFVOvO0jns"}' -H "Content-Type: application/json"

this leaded me to an error:

{
    "fault": {
        "detail": {
            "errorcode": "scripts.node.runtime.ScriptExecutionError"
        },
        "faultstring": "Script execution failed: Cyclic {0} value not allowed.: TypeError: Cyclic {0} value not allowed.
    at /organization/environment/api/node_modules/express/lib/response.js:231
    at sendError (/organization/environment/api/api/controllers/volos-oauth.js:132)
    at /organization/environment/api/api/controllers/volos-oauth.js:52
    at /organization/environment/api/node_modules/volos-oauth-common/lib/oauth.js:237
    at /organization/environment/api/node_modules/volos-oauth-common/lib/oauth.js:279
    at checkResultError (/organization/environment/api/node_modules/volos-oauth-apigee/lib/apigeeoauthimpl.js:466)
    at /organization/environment/api/node_modules/volos-oauth-apigee/lib/apigeeoauthimpl.js:435
    at /organization/environment/api/node_modules/apigee-access/lib/oauth.js:56
"
    }
}

So, we tried to call like this:

curl -i -X POST --user 4t8X137pOUUtMR7wag3M1yZTcRxeK:RAcOFVOvO0jns "http://<org>-<env>.apigee.net/edgemicro-auth/token?grant_type=client_credentials" -d '{"grant_type": "client_credentials"}' -H "Content-Type: application/json"

And with this the token could be retrieved without any problem whatsoever!

Is there any reason for the documentation request the token that way? Or is the documentation out of date?

Thanks

Regards

1 2 393
2 REPLIES 2

Thanks for pointing this out @Ciro Santos, the doc is incorrect - you need to send the app credentials in the basic auth header, we will fix the documentation.

The doc has been corrected. Thanks for flagging it.