swift-processor-51967
08/07/2025, 10:52 PMcreateOryMiddleware(CONFIG.auth.config)
. Running locally, when I click the login link (href="<http://localhost:3000/self-service/login/browser?return_to=http%3A%2F%2Flocalhost%3A3000>"
), I do the login flow and then am redirected back to my app. But, the session cookie fails to be set due to the lack of SameSite
settings on the cookie, thus getServerSession()
continually returns null
. Within the Ory Admin, I’ve set the “Same Site” to “Strict” but am seeing no change. Any suggestions?early-magician-18981
08/07/2025, 11:55 PMswift-processor-51967
08/08/2025, 4:28 PMcreateOryMiddleware()
? I was under the understanding that this eliminates the need for Ory Tunnel. For example, this post makes no mention of Ory Tunnel: https://www.ory.sh/blog/add-auth-to-nextjs-security-best-practicesswift-processor-51967
08/08/2025, 4:29 PMearly-magician-18981
08/08/2025, 5:02 PMswift-processor-51967
08/13/2025, 7:34 PMprehistoric-magician-21755
08/13/2025, 7:47 PMprehistoric-magician-21755
08/13/2025, 7:48 PMprehistoric-magician-21755
08/13/2025, 7:49 PMprehistoric-magician-21755
08/13/2025, 7:49 PMearly-magician-18981
08/13/2025, 8:16 PMswift-processor-51967
08/13/2025, 8:42 PMWhile the middleware is there, it just matches your orySdkUrl as the path and it would need to match that localhost for local devI’m not sure how you arrived at this conclusion. The middleware proxies requests to Ory, thereby sidestepping the need for the tunnel: • https://github.com/ory/elements/blob/main/packages/nextjs/src/middleware/middleware.ts#L87-L95 • https://github.com/ory/elements/blob/main/packages/nextjs/src/utils/sdk.ts#L11-L21
early-magician-18981
08/13/2025, 8:46 PMearly-magician-18981
08/13/2025, 8:48 PMswift-processor-51967
08/13/2025, 8:48 PMearly-magician-18981
08/13/2025, 8:49 PMearly-magician-18981
08/13/2025, 8:49 PMearly-magician-18981
08/13/2025, 8:49 PMearly-magician-18981
08/13/2025, 8:50 PMearly-magician-18981
08/13/2025, 8:52 PMbland-eye-99092
08/13/2025, 10:11 PMswift-processor-51967
08/13/2025, 11:31 PMHi! Do you have a public repo with a reproduction?Public Repo: Yes. https://github.com/source-cooperative/source.coop/tree/s2 Middleware Usage: https://github.com/source-cooperative/source.coop/blob/s2/src/middleware.ts#L5 (
CONFIG.auth.config
is not actually populated with anything, https://github.com/source-cooperative/source.coop/blob/s2/src/lib/config.ts#L48-L58)
Also do you have a custom domain configured?Yes, https://auth.s2.source.coop/