Fix WSO2 API Manager Token generation issue due to no matching grant type(Error occurred while calling token endpoint: HTTP error code : 400)


If you have migrated API Manager setup then sometimes you may see this error due missed entries in tables.
"Error occurred while calling token endpoint: HTTP error code : 400"

If we dont have  grant_type in IDN_OAUTH_CONSUMER_APPS table and then that may cause this error.
Grant_type may be emplty for the Default Application in IDN_OAUTH_CONSUMER_APPS table. Also in IDN_OAUTH2_ACCESS_TOKEN table grant_type may be NULL.

When you try to generate tokens for that application you may see error like below.
"Error occurred while calling token endpoint: HTTP error code : 400"
Since the token regenerate process try to match the grant_types of IDN_OAUTH2_ACCESS_TOKEN with grant_types of IDN_OAUTH_CONSUMER_APPS.

To fix that we can update IDN_OAUTH2_ACCESS_TOKEN table as 'client_credentials' and grant_type of the IDN_OAUTH_CONSUMER_APPS as 'urn:ietf:params:oauth:grant-type:saml2-bearer iwa:ntlm implicit refresh_token client_credentials authorization_code password'

If this effected multiple places do same for all application. Then restart servers.
Now when you generate tokens you should be able to generate tokens.

No comments:

Post a Comment

Empowering the Future of API Management: Unveiling the Journey of WSO2 API Platform for Kubernetes (APK) Project and the Anticipated Alpha Release

  Introduction In the ever-evolving realm of API management, our journey embarked on the APK project eight months ago, and now, with great a...