Dattatray
Dattatray

Reputation: 1871

Salesforce OAuth authentication bad request error

I am trying to run a simple example to authenticate with Salesforce using a Java code.

I am getting below error - 400 Bad Request

The login URL which I am using is

https://login.salesforce.com/services/oauth2/token?grant_type=password&client_id=clienty_id&client_secret=client_secret&username=username&password=password

I also tried removing the amp and ;

https://login.salesforce.com/services/oauth2/token?grant_type=password&client_id=clienty_id&client_secret=client_secret&username=username&password=password

But still got the same error 400 bad request.

Upvotes: 3

Views: 4923

Answers (1)

D VEL
D VEL

Reputation: 31

You need to try this call with a "POST" callout. When you use the "GET" method, you get the 400 bad request issue. or You missed appending security token at the end of the password

https://login.salesforce.com/services/oauth2/token?grant_type=password&client_id={clientId}&client_secret={client_secret}&username={userName}&password={password}{securitytoken}

Method : POST

Upvotes: 3

Related Questions