Skip to content

Commit

Permalink
chore(next-auth): add github as oauth provider
Browse files Browse the repository at this point in the history
  • Loading branch information
doinel1a committed May 9, 2024
1 parent 997cad6 commit dc47793
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
3 changes: 2 additions & 1 deletion auth.ts
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]
});

41 changes: 25 additions & 16 deletions src/app/page.tsx
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>
);
}

0 comments on commit dc47793

Please sign in to comment.