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
BPOORBPOOR 

OAuth Internal Server Error

Hello friends,

I am trying to get an OAuth access token from Salesforce, but I am getting a "500 - Internal Server Occured." Can someone help?

Below is the curl command I am using.

curl -v -k https://test.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id={client_id}" -d "client_secret={client_secret}" -d "username={sfdc_userid}" -d "password={sfdc_password}"

I tried with specific instane URL () also, but I am getting the same error.
Best Answer chosen by BPOOR
BPOORBPOOR
I got the issue resolved. The password for the user was having a single quote in it which was causing the issue. I tried to escape it with backslash (\), tried \u0027 and none of them work. I ended up changing the password to plain alphanumeric with regular special characters and then it is working fine. Thanks, Balaji.

All Answers

Manj_SFDCManj_SFDC
Are you appending the security token with the password, if not please give a try by appending it
Manj_SFDCManj_SFDC
Check your login history details in SF it will get you more details whether the security token is needed or your request is coming from non trusted ip, you may try adding your IP to trusted IP ranges from network access
BPOORBPOOR
@Manjunath, thanks for your response. I tried with and without the security token and the results are same.
Manj_SFDCManj_SFDC
Did you check the login history , what’s the error mentioned there, did you add your IP to the trusted range 
BPOORBPOOR
I got the issue resolved. The password for the user was having a single quote in it which was causing the issue. I tried to escape it with backslash (\), tried \u0027 and none of them work. I ended up changing the password to plain alphanumeric with regular special characters and then it is working fine. Thanks, Balaji.
This was selected as the best answer
Manj_SFDCManj_SFDC
Glad it is solved please mark the question as solved
good luck
BPOORBPOOR
How do I mark the question as solved? Just selecting the best answer?