mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 03:15:06 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Clarified API key changes (new publishable/secret scheme, where to obtain each, legacy keys valid through end of 2026) and updated many getting-started tutorials with clearer setup, flow, and auth guidance. * **New Features** * Added/expanded profile photo/avatar upload and account integration steps across multiple tutorials. * **Guides** * Added guidance on auth helper methods and when to use them. * **Examples** * Example app updated to use token claims for auth state. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Katerina Skroumpelou <mandarini@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
29 lines
594 B
React
29 lines
594 B
React
function App() {
|
|
const [claims, setClaims] = useState(null)
|
|
|
|
useEffect(() => {
|
|
const loadClaims = async () => {
|
|
const {
|
|
data: { claims },
|
|
} = await supabase.auth.getClaims()
|
|
setClaims(claims)
|
|
}
|
|
|
|
loadClaims()
|
|
|
|
const {
|
|
data: { subscription },
|
|
} = supabase.auth.onAuthStateChange(() => {
|
|
loadClaims()
|
|
})
|
|
|
|
return () => subscription.unsubscribe()
|
|
}, [])
|
|
|
|
return (
|
|
<div className="container" style={{ padding: '50px 0 100px 0' }}>
|
|
{!claims ? <Auth /> : <Account key={claims.sub} claims={claims} />}
|
|
</div>
|
|
)
|
|
}
|