-
Notifications
You must be signed in to change notification settings - Fork 249
feat: add Google sign-up option to Console #3104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,6 +121,22 @@ | |
| scopes: ['read:user', 'user:email'] | ||
| }); | ||
| } | ||
| function onGoogleLogin() { | ||
| let successUrl = window.location.origin; | ||
|
|
||
| if (page.url.searchParams.has('code')) { | ||
| successUrl += `?code=${page.url.searchParams.get('code')}`; | ||
| } else if (page.url.searchParams.has('campaign')) { | ||
| successUrl += `?campaign=${page.url.searchParams.get('campaign')}`; | ||
| } | ||
|
|
||
| sdk.forConsole.account.createOAuth2Session({ | ||
| provider: OAuthProvider.Google, | ||
| success: successUrl, | ||
| failure: window.location.origin, | ||
| scopes: ['profile', 'email'] | ||
| }); | ||
| } | ||
| </script> | ||
|
|
||
| <svelte:head> | ||
|
|
@@ -138,6 +154,12 @@ | |
| <span class="icon-github" aria-hidden="true"></span> | ||
| <span class="text">Sign up with GitHub</span> | ||
| </Button> | ||
| <div style:margin-top="var(--gap-s, 8px)"> | ||
| <Button secondary fullWidth on:click={onGoogleLogin} {disabled}> | ||
| <span class="icon-google" aria-hidden="true"></span> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Every other OAuth icon ( |
||
| <span class="text">Sign up with Google</span> | ||
| </Button> | ||
| </div> | ||
|
Comment on lines
+157
to
+162
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The PR description says "Wrapped both OAuth buttons in a Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
| </div> | ||
| <span class="with-separators eyebrow-heading-3">or</span> | ||
| {/if} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The login page (
/login) only offers GitHub OAuth, so a user who registers with Google will find no matching sign-in option on the login page and will likely be confused or stranded. If the intent is to ship both pages together, the correspondingonGoogleLogin()handler and button need to be added tosrc/routes/(public)/(guest)/login/+page.svelteas well.