Next.js Discord

Discord Forum

Sharing a cookie cross-domain

Unanswered
American Chinchilla posted this in #help-forum
Open in Discord
American ChinchillaOP
I have a nextjs app running deployed at domain.com, it uses next-auth for authentication which creates 3 cookies and store them as httponly. This totally fine as long as requests are within the nextjs application. When I try to send a request to a cloudflare worker hosted at cfdomain.com cookies are not sent so I can not authenticate the user. (Note that domains' names are for demonstartion)

I need a way to make the cookies to be sent to the cloudflare worker too. I used { credentials : true} on the fetch request but it did not help. Any suggestions?

1 Reply

English Lop
Domain masking will not work? "cf.domain.com" => "cfdomain.com", cookie domain "domain.com", request from "domain.com" to "cf.domain.com" including credentials