-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(auth-server): handle preflight requests #1040
Conversation
public handlePreflightRequest(response: http.ServerResponse): void { | ||
// We don't validate the origin here because: | ||
// 1. The default login URL (login.salesforce.com) will not match after a redirect or if user choose a custom domain in login. | ||
// 2. There's no fixed list of auth URLs we could check against. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
point 1 refers to the oauth config object that can be accessed here.
If the value of the Origin header is not a case-sensitive match for any of the values in list of origins do not set any additional headers and terminate this set of steps.
Always matching is acceptable since the list of origins can be unbounded.
This issue has been linked to a new work item: W-15313611 |
QA Notes
✅ : able to |
What does this PR do?
Updates the auth web server to handle preflight requests.
Chrome v123 (promoted to stable 2 days ago) now does a preflight request (
OPTIONS
req) to the server before the auth request, the server only handledGET
request and was throwing on anything else, blocking the web auth flow.repro:
sf org login web
, type auth creds in browser and click on loginsf
exits withInvalid request method: OPTIONS
error.on the network tab you can see the preflight request that causes the failure:
testing:
link this branch into plugin-auth and follow the repro steps, the preflight request is handled correctly and auth can follow.
What issues does this PR fix or reference?
@W-15313611@
forcedotcom/cli#2785