Question

I am new to APIGee. In my project i am using OAuth 2.0 for Authentication.But i am not able to generate the Access Token. I have created all required policies, but still i am getting the same error all the time.

This is the command i am using to generate the Access Token.

I am using Postman to generate the Access Token.

https://<myorgname>test.apigee.net/<myproxyname>/client_credential/accesstoken?grant_type=client_credentials&client_id=<myclient_id>&client_secret=<myclient_secret>’

I have also tried with curl

https://<myorgname>test.apigee.net/<myproxyname>/client_credential/accesstoken?grant_type=client_credentials -X POST -d 'client_id=<myclient_id>&client_secret=<myclient_secret>’

Both of them give the same error

{ "fault": { "faultstring": "Classification failed for host orgname-test.apigee.net", "detail": { "code": "CLASSIFICATION_FAILED" } } }

Please help. Thanks in advance.

Était-ce utile?

La solution

"Classification failed" generally means that the URL is not resolving to any endpoint. There can be several reasons for this:

  1. You are sending in the wrong URL. The URL you need to send in is hostname + basepath + pathsuffix. When you create a proxy in Apigee, by default your basepath will look something like /v1/proxyname. Make sure the /v1 isn't missing. You can also use trace to see what the hostname + basepath is supposed to be.
  2. You are calling https, but your proxy isn't set up for it. Make sure the secure virtual host is referenced in your ProxyEndpoint.
  3. Your HTTP verb may be incorrect. Usually you need to use a POST to get an OAuth token. Make sure your verb matches your implementation. If you don't provide a verb using CURL, it defaults to GET.
  4. Probably not the cause of your error, but the OAuth parameters are generally sent in via a x-www-form-urlencoded payload, not via the command line. Also, the client ID and secret are generally passed in via Basic Auth. Apigee expects these locations by default. See the OAuth 2.0 spec and Apigee's docs for details.

Autres conseils

This error usually means the message processors are not able to classify the request - classification error. This can happen due to one of the following:

  • the proxy is not deployed to the environment that you are hitting

  • the request host header doesn't match the hostAlias for the environment on which the proxy is deployed.

More details on https://community.apigee.com/questions/13707/unable-to-identify-proxy-for-host.html

Usually the OAuth proxy in APIGEE portal is neither deployed in "Prod" or "Test" initially. We have to manually deploy it to either of the environments to get it working.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top