Provide request context to custom Adapter #4792
Replies: 3 comments 1 reply
-
If you mean the incoming I don't see this as a general enough use case to pass it to all adapter methods. |
Beta Was this translation helpful? Give feedback.
-
The CredentialsProvider({
name: "Credentials",
async authorize(credentials, req) {
const context = getContext(req);
// ... validate credentials with the given request context
}
}) So why doesn't the Seriously, it's a dumb fix! Just add the next-auth/packages/next-auth/src/core/routes/callback.ts Lines 208 to 211 in 2469e44 Would become const invite = await useVerificationToken?.({
identifier,
token: hashToken(token, options),
}, params) etc. |
Beta Was this translation helpful? Give feedback.
-
I think this discussion has become stale in favor if this one : #4865 |
Beta Was this translation helpful? Give feedback.
-
Description 📓
While implementing a custom adapter, I can't find any way to obtain the
request
context in order to save device information when performing requests. We use this data in order to debug when clients have issues, so we can track what devices they use to connect, etc. I am aware that I could go around this by using other methods during the authentication pipeline, but it seems redundant to make two requests instead of one.As far as I can see, all methods from the
Adapter
interface have a single parameter, adding the request as the second argument would provide that functionality.Ex:
How to reproduce ☕️
Nothing to reproduce
Contributing 🙌🏽
Yes, I am willing to help implement this feature in a PR
Beta Was this translation helpful? Give feedback.
All reactions