function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sam TSam T 

Talend to Salesforce Oauth error audience is invalid

Hellow experts,

I am getting below error while trying to establish the Oauth connection (JWT) between Talend and Salesforce :

RuntimeException: HTTP status:400 - Bad Request message:
{"error":"invalid_grant","error_description":"audience is invalid"}

I have followed the steps mentioned in the below link for creating Connected App in Salesforce.

https://developer.salesforce.com/docs/atlas.en-us.210.0.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_connected_app.htm

Please note I am able to connect using basic method which uses my username, password and security token.

Problem is when I try to setup an OAuth connection.

Here are the steps I have performed :
Downloaded the self signed certificate from salesforce.
Created the connected app
Used following url to authenticate the user
https://test.salesforce.com/services/oauth2/authorize? client_id=[Consumer Key]&redirect_uri=https://test.salesforce.com/services/oauth2/success&response_type=code
Settings on talend connection:
Name : Name of the Connection
Connection Type : oAuth
Oauth2 flow type : Json web token Flow
Issuer : client_Id from connected app
Subject : Salesforce userName
Expiration in time : 600
Keystore : Certificate from salesforce
Keystore Password : password for certificate
Certificate alias : Name of the certificate.
Advanced setting : Salesforce Url :https://test.salesforce.com/services/oauth2

Please help. Any information would be a great help.

Cheers
 
NagendraNagendra (Salesforce Developers) 
Hi Sam,

Sorry for this issue you are facing.

May I request you please confirm if you have created your own connected app required by JWT Flow in Salesforce.

I've tried the steps mentioned in the document and it works fine.
User-added image
Thanks,
Nagendra
Sam TSam T
Hi Nagendra,

I have created my own connected app. I am able to setup the OAuth connection same as you for salesforce production . But the problem is I am not able to setup the same in a Sandbox.

Is it not possible at all or there is a way to setup OAuth in Sandbox with Talend.Please check the below link. Another user mentioned there is only Basic method possible in Sandbox and Oauth in Production.
https://github.com/Talend/components/issues/1423

Thanks