File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -113,9 +113,17 @@ const AppContent: React.FC = () => {
113113 }
114114
115115 // If user is logged in and trying to access auth page, redirect to account
116+ // UNLESS there's a callback/redirect_url parameter (CLI auth flow)
116117 if ( user && currentPage === 'auth' ) {
117- window . location . hash = 'account' ;
118- return null ;
118+ // Parse URL parameters from the hash (e.g., #auth?callback=...)
119+ const hashParts = window . location . hash . split ( '?' ) ;
120+ const urlParams = new URLSearchParams ( hashParts [ 1 ] || '' ) ;
121+ const hasCallback = urlParams . get ( 'callback' ) || urlParams . get ( 'redirect_url' ) ;
122+
123+ if ( ! hasCallback ) {
124+ window . location . hash = 'account' ;
125+ return null ;
126+ }
119127 }
120128
121129 // If user is not logged in and trying to access account page, redirect to welcome
Original file line number Diff line number Diff line change @@ -27,8 +27,10 @@ const Auth: React.FC = () => {
2727 const [ isRedirecting , setIsRedirecting ] = useState ( false ) ;
2828
2929 // Get redirect URL from URL params (for CLI integration)
30- const urlParams = new URLSearchParams ( window . location . search ) ;
31- const redirectUrl = urlParams . get ( 'redirect_url' ) ;
30+ // Parse URL parameters from the hash (e.g., #auth?callback=...)
31+ const hashParts = window . location . hash . split ( '?' ) ;
32+ const urlParams = new URLSearchParams ( hashParts [ 1 ] || '' ) ;
33+ const redirectUrl = urlParams . get ( 'redirect_url' ) || urlParams . get ( 'callback' ) ;
3234
3335 const generateTokenAndRedirect = async ( ) => {
3436 if ( ! redirectUrl || ! user ) return ;
You can’t perform that action at this time.
0 commit comments