Question 💬
When invoking the front end signIn() method, I get redirected to my custom sign in page. If I then hit the back button, it goes back to a blank page with about:blank in the URL.
Is there a way to configure history or back behaviour when invoking the front end singIn() method or is this a bug?
I'm following the pages documentation v3.
How to reproduce ☕️
[...nextauth].ts
...
pages: {
signIn: '/auth/signin',
},
...
Nav component
...
<button onClick={() => signIn()}>
Log in
</button>
...
My sign in page is basically a combo of email and providers (not email).
/pages/auth/signin.tsx
import { FunctionComponent } from 'react';
import { GetServerSideProps } from 'next';
import {
signIn,
getSession,
getProviders,
getCsrfToken,
ClientSafeProvider,
} from 'next-auth/client';
interface SigninProps {
providers: ClientSafeProvider[];
csrfToken: string;
}
const Signin: FunctionComponent<SigninProps> = ({ providers, csrfToken }) => {
return (<>...</>);
};
export default Signin;
export const getServerSideProps: GetServerSideProps = async (ctx) => {
const {req, res} = ctx;
const session = await getSession();
if (session && res && session.access_token){
res.writeHead(302, {
location: '/'
});
res.end();
return;
}
const providers = await getProviders();
let csrfToken: string = null;
if (Object.values(providers).find((p) => p.type === 'email')) {
csrfToken = await getCsrfToken(ctx);
}
const providersWithoutEmail = Object.values(providers).filter(
(p) => p.type !== 'email'
);
return {
props: {
providers: providersWithoutEmail,
csrfToken,
},
};
};
Contributing 🙌🏽
No, I am afraid I cannot help regarding this
Question 💬
When invoking the front end
signIn()method, I get redirected to my custom sign in page. If I then hit the back button, it goes back to a blank page withabout:blankin the URL.Is there a way to configure history or back behaviour when invoking the front end
singIn()method or is this a bug?I'm following the pages documentation v3.
How to reproduce ☕️
[...nextauth].tsNavcomponentMy sign in page is basically a combo of email and providers (not email).
/pages/auth/signin.tsxContributing 🙌🏽
No, I am afraid I cannot help regarding this