[Talend SF Connection JWT]runtime exception https status 400-bad request message {“error”:“invalid_grant”,“error_description”:“audience is invalid”}

Two Stars

[Talend SF Connection JWT]runtime exception https status 400-bad request message {“error”:“invalid_grant”,“error_description”:“audience is invalid”}

Hi Community ,

 I am facing an error while trying to establish the Oauth connection (JWT) between talend ETL tool and salesforce :

runtime exception https status 400-bad request message {"error":"invalid_grant","error_description":"audience is invalid"}

Here are the steps I have performed : (Talend Documentation)

  1. Downloaded the self signed certificate from salesforce.
  2. Created the connected app
  3. Used following url to authenticate the user

    https://test.salesforce.com/services/oauth2/authorize? <client_id>=& redirect_uri=https://test.salesforce.com/services/oauth2/success& response_type=code

Settings on talend connection:

  1. Name : Name of the Connection
  2. Connection Type : oAuth
  3. Oauth2 flow type : Json web token Flow
  4. Issuer : client_Id from connected app
  5. Subject : Salesforce userName
  6. Expiration in time : 600
  7. Keystore : Certificate from salesforce
  8. Keystore Password : password for certificate
  9. Certificate alias : Name of the certificate.

Advanced setting : Salesforce Url :https://test.salesforce.com/services/oauth2

 

Thanks in advance

Moderator

Re: [Talend SF Connection JWT]runtime exception https status 400-bad request message {“error”:“invalid_grant”,“error_description”:“audience is invalid”}

Hello,

Could you please take a look at this page to know more about 400 bad request error and check the error in the URL as suggested?

Feel free to let us know if it is OK with you.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Highlighted
Six Stars

Re: [Talend SF Connection JWT]runtime exception https status 400-bad request message {“error”:“invalid_grant”,“error_description”:“audience is invalid”}

Hello praveenbonalu,

 

I am facing similar problem when trying to do a test connection to the Salesforce sandbox. Please let me know how did you resolve this. Thanks Sam

Six Stars

Re: [Talend SF Connection JWT]runtime exception https status 400-bad request message {“error”:“invalid_grant”,“error_description”:“audience is invalid”}

Hi Sabrina, Please can you help me on this one. Exact error I am getting and having seen the 400 bad request page not getting anything where could be the problem. I understand the problem is with URL. We are having URL in 2 places one mentioned in the Salesforce connected apps for the callback url. and another one in the advance option of the salesforce connection as originally mentioned in this post.

not sure which url is having problem as both can be access by the user id.thanks

Moderator

Re: [Talend SF Connection JWT]runtime exception https status 400-bad request message {“error”:“invalid_grant”,“error_description”:“audience is invalid”}

Hello @samT

Sorry for our silence. We do our best to answer as many posts as possible.

We have replied to your another topic:https://community.talend.com/t5/Design-and-Development/Talend-DI-7-0-to-Salesforce-connection-using-...

Could you please have a look at it?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Two Stars

Re: [Talend SF Connection JWT]runtime exception https status 400-bad request message {“error”:“invalid_grant”,“error_description”:“audience is invalid”}

Hello guys,

 

We faced the same issue a few weeks ago and we found the reason of this as you can see here: https://github.com/Talend/components/issues/1423

 

This is a part of the component code which handles the JWT authentication. The audience URL seems to be hardcoded for a Production environment and there is no way to make it works with a Sandbox environment. So we used a basic auth for sandbox and a JWT auth for the production.

 

Regards

Six Stars

Re: [Talend SF Connection JWT]runtime exception https status 400-bad request message {“error”:“invalid_grant”,“error_description”:“audience is invalid”}

Hello Harry, thanks for your reply.

Problem is without testing the Oauth in sandbox I cannot deploy the job in production. 

 

I can't find SalesforceJwtConnection.java in the Talend studio installed folder. Please let me know if you manage to find any workaround for Sandbox.

 

Thanks

Cloud Free Trial

Try Talend Cloud free for 30 days.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.