LWC-banner

Authentication Failure error:

We cannot create LWC, open scratch org,local development or push the changes to the scratch org since the org is expired (min:1 day, max: 30days)and it is not authorized.

I. RESOLVING AUTHENTICATION FAILIURE ERROR

STEP 1

Authorize a dev Hub

Navigation: Click on the org or scratch org
2
The below SFDX commands and all orgs will be showed in the list
3
It shows all the connected orgs, scratch org and scratch org that are expired(x) too.

Command palette: SFDX: Authorize a Dev Hub

OUTPUT:

3
Thus the Dev Hub is authorized.

STEP 2

Set a Default Org

Command palette: SFDX: Authorize an Org
3
Thus org is authorized.

II. RESOLVING REFRESH TOKEN AUTH ERROR

STEP 3

Pushing Changes to Default Scratch org

Command: SFDX: Push Changes to Default Scratch org

OUTPUT:

3

ERROR:

3

PROBLEMS:

3
It is failed to push changes to default org since the scratch org is expired in 30days here.

STEP 4

Check the orgs list that are connected already and their expiration date

Command: sfdx force:org:list
3
Delete Expired Scratch org:
3
Thus the expired scratch orgs are deleted.
3

III. RE-AUTHORIZE ORG & PUSH CHANGES TO SCRATCH ORG

STEP 5

Authorize dev hub org

Command: sfdx force:auth:web:login –a hlwc05 –d
(Here hlwc05 is the name)

STEP 6

Create a scratch org

Command palatte: SFDX: Create default scratch org
Give the details and set scratch duration to maximum(30days)

STEP 7

Push Changes to scratch org

Command: SFDX: Push Source to Default Scratch Org

OUTPUT:

3

STEP 8

Open the scratch org or default org

Command: sfdx force:org:open
The default org is opened in browser.
Navigation: Setup -> User Interface -> Lightning App Builder -> New -> LWC Second Scratch Org -> (Fill the details and Lightning Experience)Save
Now you can see all custom Lightning Web components created in VS code. Drag and drop the desired or required Lightning web components.
3

Source Links: