N
Nuxt2mo ago
MEE

Nuxt + Supabase: getting JWT tokens in headers when using --host on a mobile device

nuxt 3.17.7 starting app in dev with pnpm dev --host when on a mobile device connected to network <ipaddress>:3000, supabase is not persisting a session when on mobile -- but everything on my main dev laptop works just fine. even when i manually call supabase.auth.setSession with a valid session object. Immediately after calls to supabase.auth.getSession() return {data: {session: null}, error: null}. Has anyone else encountered this on --host mobile device?
2 Replies
kapa.ai
kapa.ai2mo ago
Hi @MEE. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry, but the knowledge sources provided do not contain specific information about the issue where, in a Nuxt + Supabase setup, requests from a mobile device connected via the network URL result in the Authorization Bearer header being set to the Supabase anon key instead of the expected JWT, even though useSupabaseSession contains the correct JWT. The sources do mention that the Supabase Nuxt module can automatically redirect unauthenticated users to a login page, and that headers can behave differently depending on the environment and how requests are made (e.g., SSR vs. client-side, or when using different hosts) Nuxt.js localhost redirects to /login automatically, resulting in 404 error Part 2. However, there is no explicit documentation or discussion about the specific header substitution issue you described when accessing the app from a mobile device on the same network. If you need further assistance, you may want to check the Supabase Nuxt module documentation or open an issue with more details, as this behavior is not covered in the current knowledge sources. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@868878970106556416> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?