Endpoint Access error in Production.
Hi,
I have created an endpoint in staging to Access Salesforce Access token. Endpoint works fine when I make a request through community staging, but its throwing an error when I tried to access from community production.
End point Code:
<#assign response = http.client.request("https", "login.salesforce.com", "/services/oauth2/token").body("grant_type=password&client_id=<clientid>&client_secret=<ClientSecret>&username=<username>&password=<password>", "application/x-www-form-urlencoded").post()/>
<#if response.hasError>
ERROR
<#else>
${response.content}
</#if>
Staging Output:
{"access_token":"<AccessToken>","instance_url":"<Instance_url>","id":"<ID>","token_type":"Bearer","issued_at":"<Issued_at>","signature":"<Signature>"}
Production Output:
1) Firefox:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
2)Advanced Rest Client
There was an error parsing JSON data
Unexpected token E in JSON at position 0
I have checked the Login History on salesforce and couln't able to find one for community production.
Thanks
Hi Suchith ,
it could be that you have not whitelisted the HTTP client domain.
You have to whitelist the caller domain for the http client here:
ADMIN DASHBOARD > SYSTEM > HTTP ClientHere you will find an input field called "Allowed domain names", where you can enter the http client domain.
Hope this helps.