@@ -386,31 +386,19 @@ export class WindowManager {
386386 }
387387
388388 static async openLoginWindow ( ) : Promise < string | null > {
389- // Derive the Clerk frontendApi hostname from the publishable key.
390- // Key format: pk_<type>_<base64(frontendApi + '$')>
391- const encoded = CLERK_PUBLISHABLE_KEY . split ( '_' ) [ 2 ] ?? '' ;
392- const padded = encoded + '=' . repeat ( ( 4 - ( encoded . length % 4 ) ) % 4 ) ;
393- let frontendApi : string ;
394- try {
395- frontendApi = Buffer . from ( padded , 'base64' ) . toString ( 'utf8' ) . replace ( / \$ $ / , '' ) ;
396- } catch {
397- log . error ( 'WindowManager.openLoginWindow: invalid Clerk publishable key' ) ;
398- return Promise . resolve ( null ) ;
399- }
400-
401- // Open Clerk's hosted sign-in page in a dedicated BrowserWindow.
402- // Because this window loads from HTTPS (not file://), Clerk's CDN
403- // resources and React UI components load normally — the full standard
404- // Clerk sign-in UI is displayed, including every configured OAuth provider.
405- // This mirrors the approach used by @clerk /electron without requiring that
406- // package.
389+ // Open Clerk's Accounts Portal sign-in page in a dedicated BrowserWindow.
390+ // Passing __publishable_key tells Clerk which app to authenticate against —
391+ // no hostname derivation required. Because this window loads from HTTPS
392+ // (not file://), Clerk's CDN resources and React UI components load
393+ // normally — the full standard Clerk sign-in UI is displayed, including
394+ // every configured OAuth provider.
407395 //
408- // After successful sign-in, Clerk redirects to redirect_url ('minsky://signed-in').
409- // We intercept that navigation with will-navigate, execute JS in the still-live
410- // sign-in page to obtain a JWT from window.Clerk.session.getToken(), stash it,
411- // and close the window.
396+ // After successful sign-in, Clerk redirects to redirect_url
397+ // ('minsky://signed-in'). We intercept that navigation with will-navigate,
398+ // execute JS in the still-live sign-in page to obtain a JWT from
399+ // window.Clerk.session.getToken(), stash it, and close the window.
412400 const redirectUrl = 'minsky://signed-in' ;
413- const signInUrl = `https://${ frontendApi } /sign-in?redirect_url=${ encodeURIComponent ( redirectUrl ) } ` ;
401+ const signInUrl = `https://accounts.clerk.com /sign-in?__publishable_key= ${ encodeURIComponent ( CLERK_PUBLISHABLE_KEY ) } & redirect_url=${ encodeURIComponent ( redirectUrl ) } ` ;
414402
415403 return new Promise < string > ( ( resolve ) => {
416404 const loginWindow = new BrowserWindow ( {
0 commit comments