Menttis
Menttis
NNuxt
Created by Menttis on 11/23/2024 in #❓・help
Nuxt turnstile module server side verification in cloudflare pages
Ok got it, in case some body else is wondering.. In cloudflare pages the ENV does not pass it self, it needs to be set in nuxt.config.js. Logged first the entire turnstile object and found the error: "missing-input-secret" I had in nuxt.config.js:
turnstile: {
siteKey: process.env.NUXT_PUBLIC_TURNSTILE_SITE_KEY,
addValidateEndpoint: true
},
turnstile: {
siteKey: process.env.NUXT_PUBLIC_TURNSTILE_SITE_KEY,
addValidateEndpoint: true
},
So just added the secretKey also and it worked:
turnstile: {
siteKey: process.env.NUXT_PUBLIC_TURNSTILE_SITE_KEY,
siteKey: process.env.NUXT_PUBLIC_TURNSTILE_SITE_KEY,
addValidateEndpoint: true
},
turnstile: {
siteKey: process.env.NUXT_PUBLIC_TURNSTILE_SITE_KEY,
siteKey: process.env.NUXT_PUBLIC_TURNSTILE_SITE_KEY,
addValidateEndpoint: true
},
6 replies
NNuxt
Created by roobr on 5/19/2024 in #❓・help
Nuxt 3 Supabase serverSupabaseUser(event) returning NULL
Ok, thanks. I ended up doing the checks in the server API post file. Just passed the role and jwt values from Pinia state to there in body. But middleware would be more elegant solution.
4 replies
NNuxt
Created by roobr on 5/19/2024 in #❓・help
Nuxt 3 Supabase serverSupabaseUser(event) returning NULL
Hi, did you ever get this sorted? I'm having the same issue, trying to secure server routes with middleware:
import { serverSupabaseClient } from '#supabase/server'
import { serverSupabaseUser } from '#supabase/server'
import { serverSupabaseSession } from '#supabase/server'

export default defineEventHandler(async (event) => {
const supabase = await serverSupabaseClient(event);
const user = await serverSupabaseUser(event)
const session = await serverSupabaseSession(event)

console.log('USER ' + JSON.stringify(user)) // Returns null
console.log('SESSION' + JSON.stringify(session)); // Returns null

})
import { serverSupabaseClient } from '#supabase/server'
import { serverSupabaseUser } from '#supabase/server'
import { serverSupabaseSession } from '#supabase/server'

export default defineEventHandler(async (event) => {
const supabase = await serverSupabaseClient(event);
const user = await serverSupabaseUser(event)
const session = await serverSupabaseSession(event)

console.log('USER ' + JSON.stringify(user)) // Returns null
console.log('SESSION' + JSON.stringify(session)); // Returns null

})
4 replies