From d749b1088bb884e7fbe483a9faa30537117418d6 Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Sat, 19 Jun 2021 19:58:52 +0100 Subject: [PATCH] more auth --- pages/api/auth/[...nextauth].ts | 9 --------- pages/auth-test.tsx | 14 ++++++-------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index fb42eec7a..ceb91a7b2 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -7,15 +7,6 @@ const options = { Providers.GitHub({ clientId: process.env.GITHUB_ID, clientSecret: process.env.GITHUB_SECRET, - profile(profile) { - return { - id: profile.id, - login: profile.login, - name: profile.name || profile.login, - email: profile.email, - image: profile.avatar_url, - } as any - }, }), ], callbacks: { diff --git a/pages/auth-test.tsx b/pages/auth-test.tsx index e42601749..e97ff12b8 100644 --- a/pages/auth-test.tsx +++ b/pages/auth-test.tsx @@ -49,22 +49,20 @@ export default function Home({ } export async function getServerSideProps(context: GetServerSidePropsContext) { - const session: any = await getSession(context) + const session = await getSession(context) - const handle = session?.user?.login + const image = session?.user?.image const sponsors = await fetch( 'https://sponsors.trnck.dev/sponsors/steveruizok' ).then((d) => d.json().then((d) => d.sponsors)) - const sponsor = sponsors.some( - (sponsor: { handle: string }) => sponsor.handle === handle - ) + const sponsor = sponsors.some((sponsor: any) => sponsor.avatar === image) console.log( - session, - handle, - sponsors.map((sponsor: any) => sponsor.handle) + session?.user, + image, + sponsors.map((sponsor: any) => sponsor.avatar === image) ) return {