This repository has been archived by the owner on Dec 15, 2024. It is now read-only.
generated from doinel1a/next-ts-shadcn-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(next-auth): add github as oauth provider
- Loading branch information
Showing
2 changed files
with
27 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { EdgeDBAdapter } from '@auth/edgedb-adapter'; | ||
import { createClient } from 'edgedb'; | ||
import NextAuth from 'next-auth'; | ||
import Github from 'next-auth/providers/github'; | ||
|
||
const client = createClient({ dsn: process.env.AUTH_EDGEDB_DSN }); | ||
|
||
export const { handlers, auth, signIn, signOut } = NextAuth({ | ||
adapter: EdgeDBAdapter(client), | ||
providers: [] | ||
providers: [Github] | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
import React from 'react'; | ||
|
||
import Counter from '@/components/counter'; | ||
import GithubCorner from '@/components/github-corner'; | ||
|
||
export default function Home() { | ||
return ( | ||
<main className='flex h-full w-full flex-col items-center justify-center'> | ||
<GithubCorner | ||
title='Get started on GitHub' | ||
url='https://github.com/doinel1a/next-ts-shadcn-ui' | ||
/> | ||
<Counter /> | ||
</main> | ||
); | ||
} | ||
import React from 'react'; | ||
|
||
import { auth } from 'auth'; | ||
|
||
import Counter from '@/components/counter'; | ||
import GithubCorner from '@/components/github-corner'; | ||
|
||
export default async function Home() { | ||
const session = await auth(); | ||
|
||
return ( | ||
<main className='flex h-full w-full flex-col items-center justify-center'> | ||
<GithubCorner | ||
title='Get started on GitHub' | ||
url='https://github.com/doinel1a/next-ts-shadcn-ui' | ||
/> | ||
|
||
{session?.user?.name && ( | ||
<h1 className='mb-2.5 text-3xl font-bold'>Welcome {session.user.name}</h1> | ||
)} | ||
|
||
<Counter /> | ||
</main> | ||
); | ||
} |