EnriqueSantos-dev / invoice-app-nextjs-13

invoice app frontend-mentor challenge
https://invoice-app-v1.vercel.app
1 stars 0 forks source link

New page authentication issue #1

Open vnexter opened 1 year ago

vnexter commented 1 year ago

Hi thanks for the very good example of creating a Nexjs app, i am having trouble creating another page i-e localhost/contacts axios api request returns 401 (unauthorised) but logged in user can access data directly from api/contacts as browser automatically sends token to api get method i guess. ( i actually copied all the (home) code to contacts without making any changes

homepage works fine i-e invoice list page loads without any issue any get-invoices api request by axios do not result in authorised.

Do you know if I missing anything,

Screenshot 2023-06-08 013102

EnriqueSantos-dev commented 1 year ago

Hi thanks for the very good example of creating a Nexjs app, i am having trouble creating another page i-e localhost/contacts axios api request returns 401 (unauthorised) but logged in user can access data directly from api/contacts as browser automatically sends token to api get method i guess. ( i actually copied all the (home) code to contacts without making any changes

homepage works fine i-e invoice list page loads without any issue any get-invoices api request by axios do not result in authorised.

Do you know if I missing anything,

Screenshot 2023-06-08 013102

Thank you friend. I don't have much idea what might be going wrong with your code when adding a new page. You can pass the link of your repository and I can observe more carefully what is happening.

vnexter commented 1 year ago

here is the code repo https://github.com/vnexter/invapp - thanks!

accountsware commented 1 year ago

I have also investigated, the issue is mainly on the pages where there are both server and client components - on server components loads and then after xhr request by axios the browser is automatically sent to localhost:3000/

accountsware commented 1 year ago

hi mate, was there any luck ? i could not figure out