You need to sign in to do that
Don't have an account?
Richard Webb
CORS origin set but still getting error
I am trying to make a request to an identity URL in a sandbox enviroment from an external domain. I am making the request using javascript with an endpoint such as https://test.salesforce.com/id/ORGID/USERID?oauth_token=access-token, which gives me the error
"XMLHttpRequest cannot load ..... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://example.example.com' is therefore not allowed access."
I realise this is to do with CORS, so I followed the steps at https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/extend_code_cors.html, setting the origin URL to https://example.example.com. Unfortuantely I am still getting the same error. Is there some extra step involved that I am missing? Any help would be appreciated.
"XMLHttpRequest cannot load ..... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://example.example.com' is therefore not allowed access."
I realise this is to do with CORS, so I followed the steps at https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/extend_code_cors.html, setting the origin URL to https://example.example.com. Unfortuantely I am still getting the same error. Is there some extra step involved that I am missing? Any help would be appreciated.
XMLHttpRequest cannot load https://cs51.salesforce.com/id/.... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://example.example.com' is therefore not allowed access. I have both https://example.example.com and https://*.example.com whitelisted in the CORS section.
Since I am currently using a sandbox for testing, do I need to target the sandbox domain as opposed to test.salesforce? Or do I need to target my community? Right now I am making requests to https://cs51.salesforce.com, which is my sandbox domain, but am still getting the same error.
The other aletrnate apporach is (only if you need to get User Information) to use SF REST API
https://<instance>.salesforce.com/services/data/v39.0/sobjects/User/<UserRecordID>
<UserRecordID> = Extract this value from the Indentiy URL.
Sample JS call: