I use oauth2 - client credentials to connect to datasource with auth restful api ,Execution failed with status 4000:
Invalid authentication credentials. Please check datasource configuration.
I cannot find why, i have tested basic auth method by user/pass, it’s ok .
Can any friend give me some suggest, thanks!
platform: self-hosting , docker deploy
connecting to db by rest api : oracle ords server , running on host machine, appsmith is running on docker
Hello and welcome to our community!
Can you share a screenshot of your datasource configuration (you can redact sensitive information)?
Does the API run successfully in other tools such as Postman?
I use curl or postman , they’re all ok . the curl cmd screenshot and datasource config , pls see below png. thanks!
Hi, unfortunately this is an Appsmith bug, but it has already been reported, and we are working to fix it.
You can track this bug in this link:
You can use as an alternative solution: [Bug]: Authenticate API does not read bearer token and shows errors · Issue #19645 · appsmithorg/appsmith · GitHub
- Write a JS script that gets your token
- Configure Reset API and pass authentication with the response from your JS object
To clarify my previous answer a bit, the bug report describes a problem with Appsmith passing the auth token which is being investigated by the team, your issue might be related, but it seems your case is loosely related to the bug report that he investigates it. Realizing that it sounds like your problem is a misconfiguration, I might suggest the following:
- Make sure your
Access Token URL is correct, as well as all settings.
in Authentication Type, if i select bearer token , and input a static token, api call success. from appsmith to api server has no problem . I also use basic user/pass method, has no problem too . I feel Access Token URL is also no problem. why client credential does not work , it still confused me .
Could you please share the version of Appsmith you are on and if you are using a cloud or self-hosted version of Appsmith?
I use self-hosted by docker , appsmith v1.6.5 , thanks!
I can recommend that you try two things and let me know if this fixes your problem.
update Appsmith to the latest version, you can follow this guide: Docker | Appsmith
the token URL you pass contains a private IP Appsmith doesn’t have access to it, so it fails, you could try using Ngrok to expose the port you want: https://ngrok.com/
I updated appsmith to v1.9.6, the problem is resolved . auth type with oauth2- client credentials is OK!
thanks very much! @felix-appsmith