Next.js Discord

Discord Forum

Server session in next-auth@beta from module

American black bear posted this in #help-forum
Open in Discord
American black bearOP
I'm using next-auth to authenticate and retrieve token used in external fetch() calls. The fetch() calls are made from modules in my project. How can the external modules access the token?
Previously the getServerSession() was available to me, but after upgrading to beta/v5 it requires you to import auth() from your local auth.ts. I know I can pass this on the module, but is there some global way of doing this? I was looking into fetch-interceptor to add the token to calls globally but no success.

0 Replies