I am using Kinde for authentication in my remix app.
import { handleAuth, getKindeSession } from '@kinde-oss/kinde-remix-sdk'
import { LoaderFunctionArgs } from '@remix-run/node'
export async function loader({ params, request }: LoaderFunctionArgs) {
return await handleAuth(request, params.index, {
async onRedirectCallback() {
const { getUserProfile } = await getKindeSession(request)
const user = await getUserProfile()
//TODO: Create user in Supabase
console.log('This is called after the user is authenticated!', user)
},
})
}
This is the auth function. It works, I can login, log out and I have a protected page.
I am using Supabase as a database. So after authentication I want to create a profile in supabase for which I need the users details. The console.log keeps being undefined however. How can I access the user right after authentication?