NextJS API endpoint - verify token
Hello,
First off, im currently studying front-end development, take this as a warning as this might be a "noob" question!
Im currently setting up my API for my NextJs application, using kinde as authentication.
As ive developed this i have used NextJS server-actions to check authentication for user and checked the role.
Now that im trying to implement this on the API route endpoints (/api) i can no longer check the auth status with "getKindeServerSession", im not really sure why but if I for example try getUser im getting "null".
As this issue showed up i have tried looking other ways for authenticate.
I have set up the SDK for management API on my NextJS API but have not really found any solution.
I have noticed that my requests to the API does not include any "cookie", for a token to check. Im thinking that the middleware used with NextJS + kindeauth is messing this up as the matcher is exluding "api" routes.
Hopefully this is very easy for someone to explain, appreciate the support, thanks in advance!
First off, im currently studying front-end development, take this as a warning as this might be a "noob" question!
Im currently setting up my API for my NextJs application, using kinde as authentication.
As ive developed this i have used NextJS server-actions to check authentication for user and checked the role.
Now that im trying to implement this on the API route endpoints (/api) i can no longer check the auth status with "getKindeServerSession", im not really sure why but if I for example try getUser im getting "null".
As this issue showed up i have tried looking other ways for authenticate.
I have set up the SDK for management API on my NextJS API but have not really found any solution.
I have noticed that my requests to the API does not include any "cookie", for a token to check. Im thinking that the middleware used with NextJS + kindeauth is messing this up as the matcher is exluding "api" routes.
Hopefully this is very easy for someone to explain, appreciate the support, thanks in advance!