-
Notifications
You must be signed in to change notification settings - Fork 12
feat: establish valid experience site sessions at startup #175
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
Conversation
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import { Org, SfError } from '@salesforce/core'; | ||
import axios from 'axios'; |
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.
Is there a reason we used axios over native node fetch (just curious).
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.
not really, it was just a little easier to get working initially. Axios has some nice extra features that help with debugging like interceptors. But yeah I could switch over to using fetch I guess
What does this PR do?
On local-dev startup, simulate the auth flow for establishing a valid SID token for sites via servlets (
/servlet/networks/switch
). Grab the valid token from those requests and append to any proxied requests back to core for the life of the local development session. Requests in the browser may still show asGuest=true but be proxied to your org with valid authentication credentials by the dev server.Create a new environment variable
SITE_GUEST_ACCESS
. When set to true, this will skip attempting to establish a valid authentication session at startup and allow you to access the site as a guest user.Note: This is more of a temporary solution to support sites auth and may evolve as we update the Beta and work towards GA
What issues does this PR fix or reference?
@W-16647027@