Skip to content

Commit

Permalink
Add GitHub as an authentication provider
Browse files Browse the repository at this point in the history
  • Loading branch information
upayanmazumder committed Nov 2, 2024
1 parent 1ef26df commit 32f6ddd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion qwik/src/components/auth/authenticate/authenticate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { component$ } from '@builder.io/qwik';
import { useSession, useSignIn } from '~/routes/plugin@auth';
import sessionStyles from "./authenticate.module.css";
import { Form } from '@builder.io/qwik-city';
import { BsDiscord, BsGoogle } from "@qwikest/icons/bootstrap";
import { BsDiscord, BsGithub, BsGoogle } from "@qwikest/icons/bootstrap";

export default component$(() => {
const session = useSession();
Expand Down Expand Up @@ -32,6 +32,14 @@ export default component$(() => {
<BsDiscord />
</button>
</Form>

<Form action={signIn} class={sessionStyles.form}>
<input type="hidden" name="providerId" value="github" />
<input type="hidden" name="options.redirectTo" value="/a/signedin" />
<button class={sessionStyles.iconButton}>
<BsGithub />
</button>
</Form>
</div>
)}
</>
Expand Down
2 changes: 2 additions & 0 deletions qwik/src/routes/[email protected]
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { QwikAuth$ } from "@auth/qwik";
import Google from "@auth/qwik/providers/google";
import Discord from "@auth/qwik/providers/discord"
import Github from "@auth/qwik/providers/github"

export const { onRequest, useSession, useSignIn, useSignOut } = QwikAuth$(
() => ({
providers: [
Google,
Discord,
Github
],
pages: {
signIn: "/a/signin/",
Expand Down

0 comments on commit 32f6ddd

Please sign in to comment.