New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trivial but Frustrating: Cannot find module 'next-auth/next' or its corresponding type declarations.ts(2307) #8263
Comments
I import from import { getServerSession } from 'next-auth'; |
next-auth/packages/next-auth/package.json Lines 29 to 38 in 124be4f
Likely we should expose the type declarations here. See https://www.typescriptlang.org/docs/handbook/esm-node.html#packagejson-exports-imports-and-self-referencing |
@ericvoshall when I try that I get @balazsorban44 my next-auth exports and file structure are a bit different it seems, for example it appears im missing the next directory? |
Is it in your I had a similar issue where |
@eyeHORUSdotETH this is not an issue then. You installed |
@ericvoshall @balazsorban44 thanks so much for your help 馃檹 |
How was the problem resolved? |
@SamuelOliveira-M you need to use the auth() function instead. import { auth } from '@/lib/auth';
const Page = async () => {
const session = await auth();
console.log(session);
return <p>Welcome to admin page!</p>;
};
export default Page; |
Thank you, I hadn't found this page containing some changes from version 5. |
How can I add a token from a custom API to the NextAuth v5 session when I authenticate a user using the authorize method with the Credentials provider? When performing authentication, the authorize method returns an object with the structure:
How can I extract the token from this custom API and save it in the NextAuth session for later use, such as authorizing requests? This is the complete code:
|
Question 馃挰
I'm using NextJS 13.4.7 with Typescript and I simply cannot find or import next-auth/next to use
getServerSession()
Any help would be greatly appreciated, I'm completely at a loss for where to look or what to try at this point.
Thanks!
How to reproduce 鈽曪笍
Contributing 馃檶馃徑
Yes, I am willing to help answer this question in a PR
The text was updated successfully, but these errors were encountered: