Next.js Discord

Discord Forum

AuthContext not working

Unanswered
Bachman's Warbler posted this in #help-forum
Open in Discord
Bachman's WarblerOP
So I have group routes (main) and studio both with layout.tsx I wrapped the layouts in a context but I am still having issues where I can access register and login pages even though I am logged in. As a matter of fact if I navigate the pages I can go back to the landing page and still see the register and login links in the navbar.

Supposedly the layout must be at app level but then this duplicate layouts in my group routes.

3 Replies

Bachman's WarblerOP
So apparently I must have a layout in the app level to apply globally and it is working but in group routes I also need layouts in the route level. The problem is that I am getting either double layouts (double navbar) or the authcontext is not working.
American black bear
you will need to share some code, preferably:
1. your context implementation
2. layout.tsx which contains auth context provider
3. page.tsx or component.tsx that tries to access the context

Also try to keep components/ folder out of your app folder.
Bachman's WarblerOP
Fixed! It was issued with CORS!! Dang bad bug ! Hard to figure it out