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
docs: add Flow C and Flow D documentation for self-service profile updates and social identity linking; remove outdated SPA flow documentation; update README with architecture changes
Copy file name to clipboardExpand all lines: docs/auth-flows/C-profile-update.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
-
# Flow C: Self-Service Profile Update via SPA OIDC for Management API audience ('self' Auth0 access)
1
+
# Flow C: Self-Service Profile Update via Regular Web Client
2
2
3
3
## Description
4
-
OpenID Connect (OIDC) flow for the Auth0 Management API audience, allowing users to manage their own profiles (“self” Auth0 access). This flow shares the same client used by Flow D’s SPA client.
4
+
Flow for the Auth0 Management API audience, allowing users to manage their own profiles ("self" Auth0 access). This flow uses the LFX One Profile Client (regular web application) and implements a dual authentication pattern where users first authenticate with the main LFX One client, then obtain additional access tokens for Management API access.
5
5
6
6
## Sequence Diagram
7
7
@@ -14,7 +14,7 @@ sequenceDiagram
14
14
participant Auth0 as Auth0 Authentication API
15
15
participant Auth0Mgmt as Auth0 Management API
16
16
17
-
Note over User,Auth0Mgmt: Flow C: 2nd OIDC flow for Management API audience<br/>("self" Auth0 access)
17
+
Note over User,Auth0Mgmt: Flow C: Secondary authentication flow for Management API audience<br/>("self" Auth0 access)
# Flow D: Link Social Identity via Regular Web Client (No Audience)
2
+
3
+
## Description
4
+
Regular web client flow for linking social identities by authenticating with the social provider. Uses the LFX One Profile Client and access_token_mgmt_self from Flow C (Management API token) to perform the actual linking operation. This flow uses server-side redirects instead of popup/webmessage pattern.
5
+
6
+
## Sequence Diagram
7
+
8
+
```mermaid
9
+
sequenceDiagram
10
+
participant Browser as User Browser
11
+
participant SSR as LFX One SSR
12
+
participant Auth0 as Auth0 Authentication API
13
+
participant NATS as NATS
14
+
participant AuthSvc as Auth Service
15
+
participant Auth0Mgmt as Auth0 Management API
16
+
17
+
Note over Browser,Auth0Mgmt: Flow D: Link social identity via regular web client<br/>(no audience - just authenticate with social provider)
18
+
19
+
Browser->>SSR: User clicks "Link Google"<br/>(or other social provider)
20
+
21
+
SSR->>Auth0: D1: GET /authorize<br/>w/ "LFX One Profile" client<br/>response_type=code<br/>[NO audience]<br/>connection=google-oauth2<br/>redirect_uri=SSR_callback
22
+
23
+
Auth0->>Browser: Present social provider<br/>authentication
24
+
25
+
Browser->>Auth0: User authenticates with<br/>social provider
26
+
27
+
Auth0->>SSR: D2: Redirect with auth_code
28
+
29
+
SSR->>Auth0: D3: POST /oauth2/token<br/>[authorization_code grant]<br/>w/ "LFX One Profile" client credentials<br/>+ auth_code<br/>[NO audience]
Copy file name to clipboardExpand all lines: docs/auth-flows/E-passwordless-email-linking.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,29 @@
1
1
# Flow E: Link Email Identity via Passwordless
2
2
3
3
## Description
4
-
SPA/SSR flow for linking additional email addresses to a user's account using passwordless authentication. All Auth0 API calls (both passwordless and Management API) are made by Auth Service, with SSR communicating via NATS pub/sub pattern. Uses access_token_mgmt_self from Flow C (Management API token) to perform the actual linking operation. The user verifies ownership of the email by entering a one-time verification code in LFX One.
4
+
SSR flow for linking additional email addresses to a user's account using passwordless authentication. Uses the LFX One Profile Client for the passwordless OTP flow. All Auth0 API calls (both passwordless and Management API) are made by Auth Service, with SSR communicating via NATS pub/sub pattern. Uses access_token_mgmt_self from Flow C (Management API token) to perform the actual linking operation. The user verifies ownership of the email by entering a one-time verification code in LFX One.
5
5
6
6
## Sequence Diagram
7
7
8
8
```mermaid
9
9
sequenceDiagram
10
-
participant Browser as User Browser/SPA
10
+
participant Browser as User Browser
11
11
participant SSR as LFX One SSR
12
12
participant NATS as NATS
13
13
participant AuthSvc as Auth Service
14
14
participant Auth0 as Auth0 Authentication API
15
15
participant MUA as Mail User Agent
16
16
participant Auth0Mgmt as Auth0 Management API
17
17
18
-
Note over Browser,Auth0Mgmt: Flow E: Link email identity via passwordless<br/>(email verification with OTP code)
18
+
Note over Browser,Auth0Mgmt: Flow E: Link email identity via passwordless<br/>(email verification with OTP code using LFX One Profile Client)
19
19
20
20
Browser->>SSR: User clicks "Add Email"<br/>and enters new email address
21
21
22
22
SSR->>NATS: E1: Publish passwordless<br/>start request with email
23
23
Note over NATS,AuthSvc: Auth Service subscribed to NATS subject
24
24
NATS->>AuthSvc: Deliver request
25
25
26
-
AuthSvc->>Auth0: E2: POST /passwordless/start<br/>w/ "LFX One Passwordless" client credentials<br/>email=new_email@example.com<br/>connection=email<br/>send=code
26
+
AuthSvc->>Auth0: E2: POST /passwordless/start<br/>w/ "LFX One Profile" client credentials<br/>email=new_email@example.com<br/>connection=email<br/>send=code
Copy file name to clipboardExpand all lines: docs/auth-flows/README.md
+36-9Lines changed: 36 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,7 @@ This directory contains sequence diagrams documenting the authentication flows u
7
7
The authentication architecture uses multiple Auth0 clients and flows to support different use cases:
8
8
9
9
-**LFX One Client**: Regular web application used for server-side rendering authentication with LFX v2 API access
10
-
-**LFX One Profile Client**: Single Page Application (SPA) used for social account linking and self-service Auth0 access (user profile updates)
11
-
-**LFX One Passwordless Client**: Regular web application used for passwordless email linking flow via Auth Service. This client supports the OTP grant type and may use different validation in the postLogin action.
10
+
-**LFX One Profile Client**: Regular web application used for social account linking, self-service Auth0 access (user profile updates), and passwordless email linking. This client supports both Authorization Code flow for Management API access and OTP grant type for passwordless flows.
12
11
-**LFX V2 Auth Service Client**: Machine-to-machine client used by Auth Service for reading user profiles
13
12
14
13
## Authentication Flows
@@ -17,20 +16,17 @@ The authentication architecture uses multiple Auth0 clients and flows to support
|[Flow A](A-auth-service-m2m-profile-lookup.md)| Auth Service M2M | Auth Service M2M |`auth0_mgmt`| Read user profiles and check email-to-username mappings |
19
18
|[Flow B](B-lfx-one-login-ssr-oidc.md)| LFX One Login (SSR OIDC) | LFX One |`lfxv2`| Authenticate users and obtain access tokens for LFX v2 API |
20
-
|[Flow C](C-spa-profile-update-oidc.md)| Self-Service Profile Updates | LFX One Profile |`auth0_mgmt`| Allow users to update their own profiles via Management API |
21
-
|[Flow D](D-spa-social-identity-linking.md)| Social Identity Linking | LFX One Profile | None | Link social identities (Google, GitHub, etc.) to user accounts |
22
-
|[Flow E](E-passwordless-email-linking.md)| Email Identity Linking | LFX One Passwordless| None | Link additional email addresses using passwordless OTP verification |
19
+
|[Flow C](C-profile-update.md)| Self-Service Profile Updates | LFX One Profile |`auth0_mgmt`| Allow users to update their own profiles via Management API |
20
+
|[Flow D](D-social-identity-linking.md)| Social Identity Linking | LFX One Profile | None | Link social identities (Google, GitHub, etc.) to user accounts |
21
+
|[Flow E](E-passwordless-email-linking.md)| Email Identity Linking | LFX One Profile| None | Link additional email addresses using passwordless OTP verification |
23
22
24
23
## Client Descriptions
25
24
26
25
### LFX One Client
27
26
The main server-side rendering client used for user authentication. This is a regular web application client that implements the authorization code flow with grant types `authorization_code` and `refresh_token` (plus `password-realm` in dev environments for Cypress testing). It obtains access tokens with the `lfxv2` audience for accessing the LFX v2 API (Traefik/Heimdall). This client is used exclusively in Flow B for the initial user login.
28
27
29
28
### LFX One Profile Client
30
-
This client is used for social account linking and self-service Auth0 access. This is a **Single Page Application (SPA)** client (`app_type: spa`) that uses the authorization code flow with PKCE and public client authentication (no client secret). It implements the popup/webmessage flow for social identity linking and allows users to update their own profiles through the Auth0 Management API with restricted permissions (users can only modify their own data). Used in Flows C and D.
31
-
32
-
### LFX One Passwordless Client
33
-
A specialized client used for the passwordless email linking flow, primarily by the Auth Service. This is a **regular web application** client (`app_type: regular_web`) that uses the passwordless OTP grant type (`http://auth0.com/oauth/grant-type/passwordless/otp`). This client is specifically designed for email verification flows and may use different validation logic in the postLogin action compared to other clients. Used exclusively in Flow E.
29
+
A **regular web application** client (`app_type: regular_web`) used for Auth0 Management API access and passwordless flows. This client uses the authorization code flow for obtaining Management API access tokens that allow users to update their own profiles and link identities. It also supports the passwordless OTP grant type (`http://auth0.com/oauth/grant-type/passwordless/otp`) for email verification flows. This client implements a dual authentication pattern where users first authenticate with the main LFX One client, then use this client to obtain additional access tokens for specific audiences (Management API) or perform passwordless verification. Used in Flows C, D, and E.
34
30
35
31
### LFX V2 Auth Service M2M Client
36
32
A **machine-to-machine (M2M)** client named "LFX V2 Auth Service" that uses the client credentials grant type. This client has restricted permissions with only `read:users` scope (but **not**`update:users`) for the Auth0 Management API. It is used exclusively by the Auth Service to perform read-only operations such as profile lookups and checking email-to-username mappings. Used exclusively in Flow A.
@@ -78,3 +74,34 @@ All Auth0 Management API calls are abstracted through the Auth Service, which co
78
74
4.**Token Scoping**: Each access token is scoped to specific audiences and permissions
79
75
5.**Abstraction Layer**: Management API calls go through Auth Service, not directly from client
80
76
77
+
## Architecture Changes (December 2025)
78
+
79
+
### Consolidation to Regular Web Clients
80
+
81
+
Based on the PoC implementation in `poc/2025-12-Express-Two-Audiences`, the authentication architecture has been updated to remove the SPA client and consolidate to regular web applications:
82
+
83
+
**Previous Architecture:**
84
+
- LFX One Client (Regular Web) - Main login
85
+
- LFX One Profile Client (SPA) - Management API access and social linking
86
+
- LFX One Passwordless Client (Regular Web) - Email verification
87
+
88
+
**Updated Architecture:**
89
+
- LFX One Client (Regular Web) - Main login for LFX v2 API access
90
+
- LFX One Profile Client (Regular Web) - All Management API operations, social linking, and passwordless flows
91
+
92
+
### Dual Authentication Pattern
93
+
94
+
The new architecture implements a dual authentication pattern:
95
+
96
+
1.**Primary Authentication**: Users first authenticate with the LFX One Client to establish their session and get LFX v2 API access
97
+
2.**Secondary Authentication**: When Management API access is needed, users authenticate again with the LFX One Management Client to get audience-specific tokens
98
+
99
+
This pattern provides better security isolation and allows for different scopes and permissions for different purposes while maintaining a unified user experience.
100
+
101
+
### Benefits
102
+
103
+
-**Simplified Architecture**: Fewer clients to manage and configure
104
+
-**Better Security**: Clear separation between different token audiences
105
+
-**Consistent UX**: All flows use server-side redirects instead of mixed SPA/popup patterns
106
+
-**Easier Deployment**: No client-side secret management or CORS concerns
0 commit comments