The GoTrue module had a lot of changes including many renames:
- Rename
GoTrue
plugin toAuth
- Rename
GoTrueConfig
toAuthConfig
- Rename
SupabaseClient#gotrue
toSupabaseClient#auth
- Rename
Auth#loginWith
toAuth#signInWith
- Rename
Auth#logout
toAuth#signOut
- Rename
LogoutScope
toSignOutScope
- Rename
AdminUserUpdateBuilder#phoneNumber
toAdminUserUpdateBuilder#phone
- Rename
UserUpdateBuilder#phoneNumber
toUserUpdateBuilder#phone
- Rename
Phone.Config#phoneNumber
toPhone.Config#phone
- Rename
Auth#sendRecoveryEmail
toAuth#resetPasswordForEmail
Old:
supabase.gotrue.sendOtpTo(Email) {
email = "[email protected]"
}
//or
supabase.gotrue.sendOtpTo(Phone) {
phoneNumber = "+123456789"
}
New:
supabase.auth.signInWith(OTP) {
email = "[email protected]"
//or
phone = "+123456789"
}
Old:
supabase.gotrue.loginWith(SSO.withProvider("provider"))
//or
supabase.gotrue.loginWith(SSO.withDomain("domain"))
New:
supabase.auth.signInWith(SSO) {
providerId = "providerId"
//or
domain = "domain"
}
The Realtime module also had a few renames:
- Rename
Realtime#createChannel
toRealtime#channel
- Remove
RealtimeChannel#join
and add newRealtimeChannel#subscribe
method, which does the same but also connects to the realtime websocket automatically - Add
Realtime.Config#connectOnSubscribe
to disable this behaviour - Rename
RealtimeChannel#leave
toRealtimeChannel#unsubscribe
- Add
SupabaseClient#channel
extension function delegating toRealtime#channel
- Rename
Realtime.Status
to reflect the new methods:UNSUBSCRIBED
SUBSCRIBING
SUBSCRIBED
UNSUBSCRIBING
The syntax for interacting with the PostgREST API has been refactored significantly. Each database method (SELECT
, UPDATE
, etc.)
now have a new builder and most of the properties which were a method parameter are now in this builder.
The filters now get applied within a filter {}
block.
Select
Old:
supabase.postgrest.from("countries").select(count = Count.EXACT) {
eq("id", 1)
}
New:
supabase.postgrest.from("countries").select {
count(Count.EXACT)
filter {
eq("id", 1)
}
}
Insert
Old:
supabase.postgrest.from("countries").update(country, returning = Returning.REPRESENTATION) { //Returning is representation by default
eq("id", 1)
}
New:
supabase.postgrest.from("countries").update(country) {
select() //Without this the "returning" parameter is `MINIMAL`, meaning you will not receive the data.
filter {
eq("id", 1)
}
}
The same applies for all other database methods. Additionally, new methods have been added to this builder:
Example:
val result = supabase.postgrest["messages"].select {
single() //receive an object rather than an array
count(Count.EXACT) //receive amount of database entries
limit(10) //limit amount of results
range(2, 3) //change range of results
select() //return the data when updating/deleting/upserting (same as settings 'returning' to REPRESENTATION before)
csv() //Receive the data as csv
geojson() //Receive the data as geojson
explain(/* */) //Debug queries
filter {
eq("id", 1)
}
}
Compose Auth also had some renames:
- Rename
ComposeAuth#rememberLoginWithGoogle
toComposeAuth#rememberSignInWithGoogle
- Rename
ComposeAuth#rememberLoginWithApple
toComposeAuth#rememberSignInWithApple
- Rename
ComposeAuth#rememberSignOut
toComposeAuth#rememberSignOutWithGoogle
Additionally, Native Google Auth on Android will now use the Credential Manager for Android 14+ devices once again.