-
Notifications
You must be signed in to change notification settings - Fork 1k
Form digest expiration in SPFx service #8413
Copy link
Copy link
Closed
Labels
area:spfxCategory: SharePoint Framework (not extensions related)Category: SharePoint Framework (not extensions related)area:spfx-in-listsstatus:working-on-itKnown issue / feature being addressed. Will use other "status:*" labels & comments for more detail.Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail.type:archive-old-issueIssues which are closed as tool old for active workIssues which are closed as tool old for active worktype:bug-confirmedConfirmed bug, not working as designed / expected.Confirmed bug, not working as designed / expected.
Metadata
Metadata
Assignees
Labels
area:spfxCategory: SharePoint Framework (not extensions related)Category: SharePoint Framework (not extensions related)area:spfx-in-listsstatus:working-on-itKnown issue / feature being addressed. Will use other "status:*" labels & comments for more detail.Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail.type:archive-old-issueIssues which are closed as tool old for active workIssues which are closed as tool old for active worktype:bug-confirmedConfirmed bug, not working as designed / expected.Confirmed bug, not working as designed / expected.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
💥 SharePoint Framework
Developer environment
Windows
What browser(s) / client(s) have you tested
Additional environment details
browser version
104.0.1293.70
SPFx version
1.15.2 (also noted in 1.15.0)
Node.js version
v16.15.1
I'm using a docker dev container to build and serve the SPFx solution.
Describe the bug / error
The problem occurs when using an SPFx service in an SPFx command set extension. The SPFx service consumes the page context and retrieves the Form Digest to be able to call SharePoint endpoints using POST requests. When leaving the page open for more than an hour, and refreshing the page, the form digest will not be retrieved appropriately. You'll get an expired Form Digest. This will lead to 403 errors on post requests.
I've documented the behavior with a sample solution, and gif file here:
https://github.com/martinlingstuyl/spfx-requestdigest-issue
Originally, I filed it with the crew of PnP.js. They are also saying it's an SPFx bug, not a pnp.js bug. See the conversation here:
pnp/pnpjs#2379
Steps to reproduce
Expected behavior
I'd expect to always get a newed-up form digest after refreshing the page.