Skip to content

Access request headers from events callbacks #8991

Answered by Wundero
michaelhays asked this question in Help
Discussion options

You must be logged in to vote

If you are using the app router, I believe you can get headers using the headers() function from next/headers. Besides that, there doesn't appear to be a way to access the headers from that callback.

Below is the reference in the code:

OAuth signIn callback found here.
If you are willing to delve into your node_modules and use something like patch-package, you could make the changes necessary yourself (the function that calls the callbacks does have access to headers), but this might be a bit tricky.

I think it could be a good addition to the library, since having access to headers (and cookies, for that matter) in the callbacks might make certain tasks easier.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@michaelhays
Comment options

@YHADJRABIA
Comment options

@heijmerikx
Comment options

Answer selected by michaelhays
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants