Being able to export NextAuthRequest from next-auth #11365
pearson974
started this conversation in
Ideas
Replies: 1 comment
-
For the time being we could just copypaste from the NextAuth source code into ours:
Is there a motivation for the typing of NextAuthRequest to not be accessible by the users of the library? Is it intended to discourage abstractions in Next.js middleware handler? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Goals
Non-Goals
Background
The scenario where we need to access the session inside of an API route handler in Next.js is a common scenario. The recommended way of doing it is by using the auth function to wrap and API route handler. The request parameter will then have an auth key on it which you can check for a valid session. However, TypeScript is complaining about the auth not existing on request because we currently cannot import
NextAuthRequest
.Proposal
Export
NextAuthRequest
tonext-auth/src/index.ts
.Beta Was this translation helpful? Give feedback.
All reactions