tulsawebdevs / website

The Tulsa Web Devs User Group Site
GNU General Public License v3.0
1 stars 13 forks source link

New Login Flow for Clerk #279

Open nguernse opened 2 months ago

nguernse commented 2 months ago

Instead of the default Clerk components, develop the following:

helmturner commented 2 months ago

What's happening is that we're using Clerk's pre-built components for auth, which limits our customization abilities. Since it's a more common use-case for Clerk in general, Clerk expects the "Sign Up" flow to be distinct from the "Sign In" flow—i.e. one must create an account before signing in.

Since we're only using GitHub OAuth as a sign-in method, from a user perspective, there is no difference between Sign In and Sign Up; as long as they're signed in to GitHub, it should be one click regardless of whether they already have an account or not.

Clerk's components, however, distinguish between the two. That is, it's not possible to 'Sign Up' using the Sign-in button, and vice-versa. While our "Sign In" modal does have a link to "Sign Up", that option is easily over-looked (especially if user's don't expect it to be a necessary step).

If we continue with a 'Github Only' auth flow, the ideal solution would involve 1 modal, and 1 button, that essentially UPSERTs a user. Given Clerk's customizability, this is almost certainly feasible... however, the complexity of the fix depends on whether this can be configured in Clerk's dashboard or not. If not, we may need to implement an auth endpoint on the backend to handle the upsert logic. In any case, this will almost certainly require a custom LogIn modal to replace the pre-built Clerk component.

CC @nguernse @zenlex @randomontherun