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
Add onAuthStateChange listener and refactor popup auth to use setToken
- Add onAuthStateChange(callback) to auth module, fires SIGNED_IN,
SIGNED_OUT, and TOKEN_REFRESHED events with an unsubscribe pattern
- Refactor popup OAuth to call setToken instead of redirecting, so
auth state propagates via events without a page reload
- Export AuthEvent, AuthEventData, AuthStateChangeCallback types
- Add unit tests for onAuthStateChange
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
/** JWT access token, present on SIGNED_IN and TOKEN_REFRESHED events. */
115
+
access_token?: string;
116
+
/** User data, present on SIGNED_IN when available. */
117
+
user?: User;
118
+
}
119
+
120
+
/**
121
+
* Callback for auth state changes.
122
+
*/
123
+
exporttypeAuthStateChangeCallback=(
124
+
event: AuthEvent,
125
+
data: AuthEventData
126
+
)=>void;
127
+
105
128
/**
106
129
* Authentication module for managing user authentication and authorization. The module automatically stores tokens in local storage when available and manages authorization headers for API requests.
0 commit comments