Use UserContextProvider to share user data
mainThe UserContextProvider component allows you to pass the Supabase user and session data down the component tree. This is useful for child components that need to access authentication state without passing props manually.
<!-- Parent Component -->
<template>
<UserContextProvider :supabaseClient="supabaseClient">
<Profile />
</UserContextProvider>
</template>
<!-- Child Component (Profile.vue) -->
<template>
{{ user.email }}
</template>
<script lang="ts" setup>
import {
injectStrict,
UserContextProviderInjection,
UserContextProviderKey
} from '@supa-kit/auth-ui-vue'
const { user } = injectStrict<UserContextProviderInjection>(UserContextProviderKey)
</script>