File tree Expand file tree Collapse file tree 3 files changed +245
-242
lines changed
Expand file tree Collapse file tree 3 files changed +245
-242
lines changed Original file line number Diff line number Diff line change 99 "@inquirer/select" : " ^2.4.7" ,
1010 "@lwc/lwc-dev-server" : " ~11.5.0" ,
1111 "@lwc/sfdc-lwc-compiler" : " ~11.5.0" ,
12- "@lwrjs/api" : " 0.16.8 " ,
12+ "@lwrjs/api" : " 0.16.9 " ,
1313 "@oclif/core" : " ^4.1.0" ,
1414 "@salesforce/core" : " ^8.6.2" ,
1515 "@salesforce/kit" : " ^3.1.6" ,
Original file line number Diff line number Diff line change @@ -66,17 +66,20 @@ export class ExperienceSite {
6666 * @returns sid token for proxied site requests
6767 */
6868 public async setupAuth ( ) : Promise < string > {
69- let sidToken = '' ; // Default to guest user access only
69+ let sidToken = '' ;
70+ // Default to guest user access if specified
71+ if ( process . env . SITE_GUEST_ACCESS === 'true' ) return sidToken ;
7072
71- // Use environment variable for now if users want to just have guest access only
72- if ( process . env . SITE_GUEST_ACCESS !== 'true' ) {
73- try {
74- const networkId = await this . getNetworkId ( ) ;
75- sidToken = await this . getNewSidToken ( networkId ) ;
76- } catch ( e ) {
77- // eslint-disable-next-line no-console
78- console . error ( 'Failed to establish authentication for site' , e ) ;
79- }
73+ // Use a provided token if specified in environment variables
74+ if ( process . env . SID_TOKEN ) return process . env . SID_TOKEN ;
75+
76+ // Otherwise attempt to generate one based on the currently authenticated admin user
77+ try {
78+ const networkId = await this . getNetworkId ( ) ;
79+ sidToken = await this . getNewSidToken ( networkId ) ;
80+ } catch ( e ) {
81+ // eslint-disable-next-line no-console
82+ console . error ( 'Failed to establish authentication for site' , e ) ;
8083 }
8184
8285 return sidToken ;
You can’t perform that action at this time.
0 commit comments