You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ARCHITECTURE.md
+77Lines changed: 77 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -358,6 +358,83 @@ const validAudiences = [
358
358
359
359
SPFx uses `AadHttpClient.getClient(clientId)` which results in tokens with the raw client ID as the audience.
360
360
361
+
### Detailed SPFx-to-API Authentication Flow
362
+
363
+
This diagram shows the complete authentication flow from when the SPFx web part loads in SharePoint to when the API validates the request and returns data.
1.**SPFx Permission Request**: The `webApiPermissionRequests` in `config/package-solution.json` declares that the SPFx solution needs access to the API:
2.**Admin Consent**: When the `.sppkg` is deployed, a SharePoint admin must approve this permission request in the SharePoint Admin Center → API Access.
427
+
428
+
3.**Token Acquisition**: SPFx uses `AadHttpClient` to silently acquire tokens:
4.**JWKS Caching**: The API caches Azure AD's public keys for 24 hours to avoid repeated JWKS fetches.
435
+
436
+
5.**User Auto-Creation**: If a valid token is received but the user doesn't exist in the database, they are automatically created with a default `viewer` role.
0 commit comments