cruvex
cruvex
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai changing either of these things somehow manages to create an infinite loop again
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai Im using the following plugin: export default defineNuxtPlugin((nuxtApp) => { const api = $fetch.create({ baseURL: '/api', credentials: 'include', }) return { provide: { api } } }) And composable: import type { UseFetchOptions } from "#app"; export function useAPI<T>( url: string | (() => string), options?: UseFetchOptions<T>, ) { return useFetch(url, { ...options, $fetch: useNuxtApp().$api }) } To call my backend. Do I have to make any changes here?
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai it seems my request is only being executed on the server side where there is no cookie present
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai in my devtools I see my session cookie is present but I dont see it when printing getRequestHeaders(event) or getRequestHeaders(event).cookie
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai When using nitros proxyRequest on my server route to proxy the request to my backend how do I pass cookies?
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai as you know by now I have a rust backend. When my nuxt server route calls my backend api there is a proxy set up in my nuxt.config.ts like this: routeRules: { '/backend-api/': { proxy: { to: process.env.BACKEND_API_URL + '/', fetchOptions: { ignoreResponseError: true, } } } }, But when my backend is not running I keep getting these warnings: [Vue Router warn]: No match found for location with path And my app seems to get stuck in an infinite loop
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai Does the following warning trigger a reroute? [Vue Router warn]: No match found for location with path
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai Never mind. it seems that every time I call setUserSession it also updates the cookie so when I try to update my session when the users actually logs in this will invalidate the session also
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai what is your opinion on this auth flow? Is this idiomatic or acceptable? and do you see any improvements to be made
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai Ok I found that I can just do setUserSession(event, {}) and this will create a session with nuxt-auth-utils. But as I undrestand correctly loggedIn from useUserSession() will only be true if the user object in the session is truthy so this will not actually log in the user which is what I wanted
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai But when I use useCookie to set the cookie manually this will not take into account my nuxt auth utils cookie settings right?
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai Is it possible to create a session cookie but not actually login. Im looking at the option of creating the session id on the client side then sending this to the server and using this for my backend authentication. Ofcourse just setting this cookie shouldnt actually authenticate the user. The callback would have to actually authenticate this cookie session id on the backend
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai Is it an idea to keep my rust backend cookie on the server side for server side -> rust backend auth and use the auth utils cookie for client side -> server side auth?
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai How exactly does the refreshsession method work in nuxt auth utils?
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai Could you show me what the server route for /api/auth/oauth-url looks like? This server route should proxy the request to my rust backend and this request returns a cookie which is set on the server side now I assume? But when the user opens the popup and discord does the request to the callback on my rust backend this cookie is not returned. Because it is only set on the server side I assume?
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai Another question. To authenticate users will click a button. This does a request to the backend which returns an oauth url. Nuxt will open a popup with this url for the user to authenticate in. THen when authentication is complete and the popup calls the callback (directly to rust backend) the backend will return html which sends a window.opener.postmessage message to my client side. Where do you recomend putting the window eventlisteren? Or do you see a better way to handle this scenario?
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai What would my api plugin look like in the bff example?
92 replies
NNuxt
Created by cruvex on 4/11/2025 in #❓・help
Advice on Nuxt project setup
@kapa.ai Would I use this custom useAPI composable to query my the server side on the client side and my rust backend on the server side? For example If I want to retrieve users do I do await useAPI(server route) on the client side and then this server route calls await useAPI(rust backend route)?
92 replies