more auth

This commit is contained in:
Steve Ruiz 2021-06-19 19:58:52 +01:00
parent fdf82d3a91
commit d749b1088b
2 changed files with 6 additions and 17 deletions

View file

@ -7,15 +7,6 @@ const options = {
Providers.GitHub({ Providers.GitHub({
clientId: process.env.GITHUB_ID, clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET, 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: { callbacks: {

View file

@ -49,22 +49,20 @@ export default function Home({
} }
export async function getServerSideProps(context: GetServerSidePropsContext) { 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( const sponsors = await fetch(
'https://sponsors.trnck.dev/sponsors/steveruizok' 'https://sponsors.trnck.dev/sponsors/steveruizok'
).then((d) => d.json().then((d) => d.sponsors)) ).then((d) => d.json().then((d) => d.sponsors))
const sponsor = sponsors.some( const sponsor = sponsors.some((sponsor: any) => sponsor.avatar === image)
(sponsor: { handle: string }) => sponsor.handle === handle
)
console.log( console.log(
session, session?.user,
handle, image,
sponsors.map((sponsor: any) => sponsor.handle) sponsors.map((sponsor: any) => sponsor.avatar === image)
) )
return { return {