Skip to content

Conversation

@VikramChilkunda
Copy link
Collaborator

Added a custom login page with Google OAuth

const token = await getToken({ req, secret: process.env.NEXTAUTH_SECRET });
if (!token) {
const signInPage = '/api/auth/signin';
const signInPage = '/login';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try moving this to globals.js

<center>
<h1 className="text-2xl font-bold mt-0 rounded-sm py-1 px-1 text-blue-800">
<div key="google">
<button onClick={ () => signIn('google', { callbackUrl: "/" }) } className='border-blue-800 border-solid border-2 p-5 rounded-lg'>
Copy link
Collaborator

@joseph082 joseph082 May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This forces users to go to the main page after logging in.
Maybe getting rid of callbackUrl will fix it: https://next-auth.js.org/getting-started/client#specifying-a-callbackurl Or try to read the query parameter from http://localhost:3000/login?callbackUrl=%2F and pass that into here. Or there might be another way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants