Add GitHub/Google OAuth sign-in and show-password toggle to Clerk login dialog#645
Add GitHub/Google OAuth sign-in and show-password toggle to Clerk login dialog#645
Conversation
…ogin dialog Agent-Logs-Url: https://github.com/highperformancecoder/minsky/sessions/93883e56-cb4c-463a-838b-565280e1743a Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
Agent-Logs-Url: https://github.com/highperformancecoder/minsky/sessions/d709eaa8-072b-4e05-ad66-96a5dbfd2e48 Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
|
@copilot LoginComponent.clerkSignInEl is undefined. I would expect it to point to the div labelled #clerkSignIn on construction of LoginComponent using the @ViewChild directive, but I'm not overly familar with these Angularisms. |
Agent-Logs-Url: https://github.com/highperformancecoder/minsky/sessions/ec328585-869b-44a9-bb1e-250cded94739 Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
You're right — the root cause is that Fixed in 36b5452 by replacing the |
|
@copilot ERROR Error: Clerk was not loaded with Ui components |
…ling Agent-Logs-Url: https://github.com/highperformancecoder/minsky/sessions/ea0b4096-a9bc-42da-9917-0e8a6054c4d8 Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
Fixed in 55794f6 with two changes: Root cause: Clerk v6 uses an internal Fix 1 — Fix 2 — |
…tron Agent-Logs-Url: https://github.com/highperformancecoder/minsky/sessions/d833ade0-d70c-484f-abc9-cb1e3ad7bda9 Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
…ndow.Clerk Agent-Logs-Url: https://github.com/highperformancecoder/minsky/sessions/d833ade0-d70c-484f-abc9-cb1e3ad7bda9 Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
Agent-Logs-Url: https://github.com/highperformancecoder/minsky/sessions/683c09f3-9471-4c6c-b16d-218c6a2dfa72 Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
Agent-Logs-Url: https://github.com/highperformancecoder/minsky/sessions/1482d1eb-94a0-43bb-bafc-69ec8f02418d Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
…ron auth Agent-Logs-Url: https://github.com/highperformancecoder/minsky/sessions/ef399f0f-200a-4aeb-81c0-f9660582d2c5 Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
…d with Ui components') Agent-Logs-Url: https://github.com/highperformancecoder/minsky/sessions/7da5d79d-7c5f-4968-8943-58398993784d Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
… derivation) Agent-Logs-Url: https://github.com/highperformancecoder/minsky/sessions/7a238887-8850-4b05-95ab-e2adf8d60497 Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
https://accounts.clerk.com/sign-in?__publishable_key=...&redirect_url=...)Original prompt
Overview
Enhance the Clerk-based login dialog with two features:
Files to Modify
1.
gui-js/libs/core/src/lib/services/clerk/clerk.service.tsAdd a new
signInWithOAuthmethod that initiates OAuth sign-in via Clerk for a given OAuth provider (GitHub or Google). Clerk's JS SDK supports this viaclerk.client.signIn.authenticateWithRedirect(...)orclerk.redirectToOAuth(...)/clerk.authenticateWithMetamaskdepending on version.For Clerk JS, the correct way to initiate an OAuth flow is:
However, since this is an Electron app (not a browser web app), the OAuth redirect approach won't work cleanly with Electron's custom protocol or
file://URLs. Instead, use the ClerkopenSignInUI or useclerk.client.signIn.createwith theoauth_github/oauth_googlestrategy and handle the OAuth flow via an external browser.The recommended approach for Electron is to open an external browser for OAuth and handle the callback through a deep link or a local HTTP server. However, looking at the existing codebase, the simplest workable approach that mirrors how Clerk recommends OAuth for non-browser environments is:
Use
clerk.client.signIn.authenticateWithRedirectwith a redirect URL pointing to a local Clerk-hosted page, and then have Electron intercept/handle it.For now, implement the method to open OAuth via the system browser using Clerk's
openSignInapproach orauthenticateWithRedirect. Use the following signature and implementation pattern that is consistent with how the existingsignInWithEmailPasswordmethod is structured:Also check
gui-js/libs/environment/src/lib/environment.tsorapp-config.tsto see ifclerkOAuthRedirectUrlor similar already exists. If not, note the field should be added toAppConfig— add it in the same file/object whereclerkPublishableKeyis defined, with a sensible placeholder value like'https://your-app.clerk.accounts.dev/v1/oauth_callback'.2.
gui-js/libs/ui-components/src/lib/login/login.component.tsCurrent content: