@ikonai/sdk-react-ui 1.3.1 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -154,22 +154,3 @@ export declare function verifyPasskeyAuthentication(authUrl: string, response: A
154
154
  * existed, which is also where app bundles shipping an older SDK copy stay.
155
155
  */
156
156
  export declare function revokeSessionOnServer(token: string, authUrlOverride?: string): Promise<void>;
157
- /**
158
- * True when this document is nested in another. A sign-in cannot be a same-tab redirect here: the
159
- * provider's consent screen sets X-Frame-Options and would simply refuse to paint.
160
- *
161
- * A cross-origin parent makes the property access itself throw, which is the embedded case too.
162
- */
163
- export declare function isEmbedded(): boolean;
164
- /**
165
- * Run the OAuth sign-in in a popup and resolve with the code it comes back with.
166
- *
167
- * The popup goes to the auth host directly rather than through an app's same-origin auth proxy: it
168
- * is a top-level window, so there is no CORS to avoid, and the return has to land on the auth
169
- * origin — the one origin that is allowed for every app, whatever address the app itself is on.
170
- * The verifier for the code stays in THIS document, so the exchange must also happen here.
171
- */
172
- export declare function runOAuthPopup(provider: LoginMethod, spaceId: string): Promise<{
173
- code: string;
174
- provider: LoginMethod;
175
- }>;
@@ -8,16 +8,30 @@ export declare const OAUTH_CONTINUE_PARAM = "ikon-oauth";
8
8
  * be looking at while they decide. So it parks the request and bounces the browser back here with a
9
9
  * pointer to it; the SDK raises the login prompt it already has; and a completed sign-in reports back.
10
10
  *
11
- * The pointer is stashed in sessionStorage rather than left in the URL because signing in with an
12
- * external provider navigates away and back, which is the same reason the pending-call handoff exists.
13
- * It is not a credential: it names a parked authorization, and the user binding is made server-side from
14
- * the token sent below, so a leaked pointer authorizes nobody.
11
+ * The pointer is kept in BOTH the URL and sessionStorage until the flow ends, and that redundancy is
12
+ * the point. Signing in with an external provider hands the browser to another origin and back, and
13
+ * what comes back is not always the same browsing context — a popup, a reopened tab, a session-storage
14
+ * partition we did not choose. Storage alone lost the pointer in exactly that case, and because the
15
+ * param had already been stripped there was nothing left to recover it from: the authorization sat
16
+ * parked, the client waited for a code forever, and the user saw an ordinary app with no sign of it.
17
+ *
18
+ * The URL copy is what survives, because the sign-in return URL is built from the current location.
19
+ * That is safe here for a reason this flow states explicitly elsewhere: the pointer is NOT a
20
+ * credential. It names a parked authorization, and the user binding is made server-side from the
21
+ * session token posted below, so a copied or referrer-leaked pointer authorizes nobody. It is cleared
22
+ * from both places the moment the flow finishes or fails.
15
23
  */
16
24
  export declare function captureOAuthContinuation(): boolean;
17
25
  export declare function hasPendingOAuthContinuation(): boolean;
18
26
  /**
19
27
  * Report the completed sign-in and hand the browser to the consent screen.
20
28
  *
29
+ * The token is passed in rather than read from storage. A signed-in browser does not necessarily have
30
+ * one there: a session backed by a refresh cookie is held in memory and its localStorage record is
31
+ * deliberately REMOVED, so reading storage returned null for a fully signed-in user and the handoff
32
+ * waited for a session that was never going to appear. The auth context holds the live token either
33
+ * way, so it is the only source that is right for both.
34
+ *
21
35
  * Only ever called after a REAL sign-in — `useAuthGuard` treats an anonymous session as not satisfying a
22
36
  * prompt, which is the guest/global exclusion this flow needs and already had. A `global` visitor is one
23
37
  * shared space-wide user, so authorizing as one would hand every client the same identity.
@@ -25,4 +39,4 @@ export declare function hasPendingOAuthContinuation(): boolean;
25
39
  * Failure clears the pointer and returns false: the app then carries on as a normally signed-in session
26
40
  * rather than trapping the user in a flow that cannot finish.
27
41
  */
28
- export declare function completeOAuthContinuation(): Promise<boolean>;
42
+ export declare function completeOAuthContinuation(token: string | null): Promise<boolean>;
@@ -37,6 +37,13 @@ export interface UseAuthGuardResult {
37
37
  * Dismiss an on-demand login prompt and return to the app. No effect on a hard sign-in wall.
38
38
  */
39
39
  dismissLoginPrompt: () => void;
40
+ /**
41
+ * Why the prompt was raised, when whoever raised it said. Render it: a sign-in screen that appears
42
+ * without explanation is one a person cannot judge. Someone sent here by an application asking to
43
+ * act on their behalf needs to know that is what they are agreeing to before they choose an account,
44
+ * not after.
45
+ */
46
+ loginPromptReason: string | null;
40
47
  }
41
48
  /**
42
49
  * Headless hook for route protection logic.