implemented auth but need to fix callback page

This commit is contained in:
Khalim Conn-Kowlessar 2023-05-25 11:52:52 +01:00
parent c3346b9583
commit 36dea89c8f
4 changed files with 35 additions and 4 deletions

9
package-lock.json generated
View file

@ -13,6 +13,7 @@
"@types/react": "18.2.7",
"@types/react-dom": "18.2.4",
"autoprefixer": "10.4.14",
"clsx": "^1.2.1",
"eslint": "8.41.0",
"eslint-config-next": "13.4.3",
"next": "13.4.3",
@ -993,6 +994,14 @@
"resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz",
"integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA=="
},
"node_modules/clsx": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz",
"integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==",
"engines": {
"node": ">=6"
}
},
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",

View file

@ -14,6 +14,7 @@
"@types/react": "18.2.7",
"@types/react-dom": "18.2.4",
"autoprefixer": "10.4.14",
"clsx": "^1.2.1",
"eslint": "8.41.0",
"eslint-config-next": "13.4.3",
"next": "13.4.3",

View file

@ -18,7 +18,21 @@ export const AuthOptions: NextAuthOptions = {
}),
],
pages: {
signIn: "/",
signIn: "/signin",
},
callbacks: {
async signIn({ user, account, profile, email, credentials }) {
return true;
},
async redirect({ url, baseUrl }) {
return baseUrl;
},
async session({ session, user, token }) {
return session;
},
async jwt({ token, user, account, profile, isNewUser }) {
return token;
},
},
};

View file

@ -1,7 +1,14 @@
import GoogleSignInButton from "./components/signin/GoogleSignInButton";
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div>Hello world</div>
</main>
<section className="flex min-h-full overflow-hidden pt-16 sm:py-28">
<div className="mx-auto flex w-full max-w-2xl flex-col px-4 sm:px-6">
<h1 className="text-center text-2xl font-medium tracking-tight text-gray-900">
Sign in to your account
</h1>
<GoogleSignInButton />
</div>
</section>
);
}