Skip to content

Commit 16d58b4

Browse files
committed
switch preview auth flow to auth gateway
1 parent b7d9564 commit 16d58b4

7 files changed

Lines changed: 125 additions & 242 deletions

File tree

.env.local.example

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
MFE_PREVIEW_AUTH_ISSUER_URL=https://auth.suncoast.systems
2-
MFE_PREVIEW_AUTH_CLIENT_ID=graphql-api-7603d234
3-
MFE_PREVIEW_AUTH_AUDIENCE=
4-
MFE_PREVIEW_AUTH_SCOPE=openid profile email
1+
MFE_PREVIEW_AUTH_GATEWAY_URL=https://login.suncoast.systems
2+
MFE_PREVIEW_AUTH_APP_SLUG=example-mfe-preview
3+
MFE_PREVIEW_AUTH_CODE_PARAM=gateway_code
54
MFE_PREVIEW_PORT=4173

.env.production.example

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
MFE_PREVIEW_AUTH_ISSUER_URL=https://auth.suncoast.systems
2-
MFE_PREVIEW_AUTH_CLIENT_ID=
3-
MFE_PREVIEW_AUTH_AUDIENCE=
4-
MFE_PREVIEW_AUTH_SCOPE=openid profile email
1+
MFE_PREVIEW_AUTH_GATEWAY_URL=https://login.suncoast.systems
2+
MFE_PREVIEW_AUTH_APP_SLUG=example-mfe-preview
3+
MFE_PREVIEW_AUTH_CODE_PARAM=gateway_code

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ Local preview:
5151

5252
Supported env vars:
5353

54-
- `MFE_PREVIEW_AUTH_ISSUER_URL` (preview login default, usually `https://auth.suncoast.systems`)
55-
- `MFE_PREVIEW_AUTH_CLIENT_ID` (preview login client id)
56-
- `MFE_PREVIEW_AUTH_AUDIENCE` (preview login audience, optional)
57-
- `MFE_PREVIEW_AUTH_SCOPE` (preview login scope, default `openid profile email`)
54+
- `MFE_PREVIEW_AUTH_GATEWAY_URL` (preview login gateway, usually `https://login.suncoast.systems`)
55+
- `MFE_PREVIEW_AUTH_APP_SLUG` (registered app slug in auth-gateway, for example `example-mfe-preview`)
56+
- `MFE_PREVIEW_AUTH_CODE_PARAM` (query key returned by gateway callback, default `gateway_code`)
5857
- `MFE_PREVIEW_PORT` (dev only)
5958

6059
## Local Preview Login
6160

62-
The local preview page (`/preview/`) now includes a login helper that runs OAuth/OIDC code+PKCE in-browser:
61+
The local preview page (`/preview/`) now includes a login helper that uses the shared auth-gateway flow:
6362

64-
1. Fill `Auth Issuer URL` and `Auth Client ID` (or set `MFE_PREVIEW_AUTH_*` env vars).
63+
1. Fill `Auth Gateway URL` and `Auth App Slug` (or set `MFE_PREVIEW_AUTH_*` env vars).
6564
2. Click `Login` on the preview page.
66-
3. After redirect back to `/preview/`, the access token is auto-filled into `Auth Token`.
67-
4. Click `Apply / Remount` to use that token for GraphQL HTTP/WS requests.
65+
3. Gateway returns to `/preview/` with a one-time code (`gateway_code` by default).
66+
4. Preview exchanges that code at `/v1/auth/exchange` and auto-fills `Auth Token`.
67+
5. Click `Apply / Remount` to use that token for GraphQL HTTP/WS requests.
6868

6969
If your auth provider returns `access_token` in URL hash (implicit flow), the preview page will capture that too.
7070

preview/index.html

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,16 @@ <h1 style="margin:0; font-size: 1.1rem;">Example MFE Local Preview</h1>
145145
<input id="authToken" />
146146
</div>
147147
<div class="row">
148-
<label for="authIssuer">Auth Issuer URL</label>
149-
<input id="authIssuer" value="https://auth.suncoast.systems" />
148+
<label for="authGateway">Auth Gateway URL</label>
149+
<input id="authGateway" value="https://login.suncoast.systems" />
150150
</div>
151151
<div class="row">
152-
<label for="authClientId">Auth Client ID</label>
153-
<input id="authClientId" />
152+
<label for="authAppSlug">Auth App Slug</label>
153+
<input id="authAppSlug" value="example-mfe-preview" />
154154
</div>
155155
<div class="row">
156-
<label for="authAudience">Auth Audience (optional)</label>
157-
<input id="authAudience" />
158-
</div>
159-
<div class="row">
160-
<label for="authScope">Auth Scope</label>
161-
<input id="authScope" value="openid profile email" />
156+
<label for="authCodeParam">Auth Code Query Param</label>
157+
<input id="authCodeParam" value="gateway_code" />
162158
</div>
163159
<div class="row">
164160
<label for="conversationId">Conversation Id (optional)</label>

0 commit comments

Comments
 (0)