diff --git a/apps/reference/_supabase_dart/upgrade-guide.mdx b/apps/reference/_supabase_dart/upgrade-guide.mdx index da6a3e6188d..6308172b836 100644 --- a/apps/reference/_supabase_dart/upgrade-guide.mdx +++ b/apps/reference/_supabase_dart/upgrade-guide.mdx @@ -54,10 +54,50 @@ try { +## Auth classes / methods -## Auth methods +### Usage of `AuthState` and `AuthRequiredState` classes -The signIn() method has been deprecated in favor of more explicit method signatures to help with type hinting. Previously it was difficult for developers to know what they were missing (e.g., a lot of developers didn't realize they could use passwordless magic links). +In v0, `AuthState` and `AuthRequiredState` were required to handle automatic token refresh and to listen to auth state change. In v1, `AuthState` and `AuthRequiredState` are deprecated, and token refresh will happen automatically just by initializing Supabase. [`onAuthStateChange`](/docs/reference/dart/upgrade-guide#listening-to-auth-state-change) can be used to action on auth state change. + + + + + +```dart +await Supabase.initialize( + url: 'SUPABASE_URL', + anonKey: 'SUPABASE_ANON_KEY', +); +... + +class AuthState extends SupabaseAuthState { + ... +} + +... + +class AuthRequiredState extends SupabaseAuthState { + ... +} +``` + + + + +```dart +await Supabase.initialize( + url: 'SUPABASE_URL', + anonKey: 'SUPABASE_ANON_KEY', +); +``` + + ### Listening to auth state change @@ -99,6 +139,8 @@ authSubscription.cancel(); ### Sign in with email and password +The signIn() method has been deprecated in favor of more explicit method signatures to help with type hinting. Previously it was difficult for developers to know what they were missing (e.g., a lot of developers didn't realize they could use passwordless magic links). +