如何为Salesforce的.well-known/openid-configuration启用CORS?
How to Enable CORS for Salesforce's OpenID Configuration Endpoint
Absolutely, you can configure CORS in Salesforce to allow your origin (https://pds-dev) to access the .well-known/openid-configuration endpoint. Here's how to set it up step by step:
- Log into your Salesforce Setup
- In the Quick Find search bar at the top, type
CORSand select Cross-Origin Resource Sharing (CORS) from the results - Click the New button to add a new allowed origin entry
- Enter your frontend origin URL exactly as it appears in the error:
https://pds-dev - Save the configuration
After saving, Salesforce will start including the Access-Control-Allow-Origin header for requests from https://pds-dev to the OpenID configuration endpoint (along with other Salesforce API and resource endpoints covered by CORS rules).
A few key notes to ensure this works smoothly:
- Double-check the origin URL for typos (no trailing slashes, correct protocol and hostname)
- If you have multiple environments (like staging or production), you’ll need to add each corresponding origin separately
- Salesforce configuration changes can take a minute or two to propagate, so wait a short time before testing your script again
内容的提问来源于stack exchange,提问作者Radu Negrila
相关产品推荐
相关产品推荐

