Replies: 1 comment
-
First, you may want to register the Server.middleware.register([
() => import("@ioc:Adonis/Core/BodyParser"),
() => import('App/Middleware/SilentAuth') // <--
]); Second, I'm not sure whether you're running into this it looks like all your calls are currently client-side in your Next app, but I'll mention it just in case. When you're working with NextJS/NuxtJS along with an AdonisJS API note that you're dealing with two servers, your Next/Nuxt server and your AdonisJS server. When you send a request from the server side of your Next/Nuxt server to your AdonisJS server, your cookies won't automatically be attached to the request like they are for client-side requests. To remedy this you'll need to:
I'm not sure what this looks like on NextJS, it's been years since I've touched it, but I have a lesson that walks through this for Nuxt here, which may be helpful |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I'm having a problem when I try to use cookies on front-end side. I'm using NextJS for front and when i try to send a request to the server using cookies, all works but when i try the same thing on middlewares, the request doesnt includes cookies. I thing the issue come from back-end, sorry if it's front
I leave you the two projects if you want to recreate it, thanks !! ;)
Front: https://github.com/erwan-eveno/ulysse-client.git
Back: https://github.com/erwan-eveno/ulysse-server.git
Beta Was this translation helpful? Give feedback.
All reactions