Starting with 3.0.0
, supabase-kt now uses Ktor 3. This brings WASM support, but projects using Ktor 2 will be incompatible.
Ktor 3.0.0-rc-1
is used in this release.
- The
gotrue-kt
module is no longer being published starting with version3.0.0
. Use the newauth-kt
module. - Rename
auth-kt
package name fromio.github.jan.supabase.gotrue
toio.github.jan.supabase.auth
.
New wasm-js
target for supabase-kt, auth-kt, storage-kt, functions-kt, postgrest-kt, realtime-kt, compose-auth, compose-auth-ui, apollo-graphql and the new coil3-integration by @jan-tennert in #311
Support for Coil3 and all Compose Multiplatform targets under a new plugin by @jan-tennert in #428. Checkout the documentation. The "old" coil 2 integration is still available and hasn't changed.
- Remove
Auth#modifyUser()
- Remove
MfaApi#loggedInUsingMfa
,MfaApi#loggedInUsingMfaFlow
,MfaApi#isMfaEnabled
,MfaApi#isMfaEnabledFlow
- Refactor SessionStatus by @jan-tennert in #725
- Move
SessionStatus
to its ownstatus
package - Rename
SessionStatus#LoadingFromStorage
toSessionStatus#Initializing
- Rename and refactor
SessionStatus#NetworkError
toSessionStatus#RefreshFailure(cause)
Note: The cause can be eitherRefreshFailureCause#NetworkError
orRefreshFailureCause#InternalServerError
. In both cases the refreshing will be retried and the session not cleared from storage. During that time, the session is obviously not usable.
- Move
- Migrate to Apollo GraphQL 4.0.0 by @jan-tennert in #692
Rework the uploading & downloading methods by @jan-tennert in #729
- Each uploading method (upload, update, uploadAsFlow ...) now has a
options
DSL. Currently, you can configure three things:
- Whether to upsert or not
- The content type (will still be inferred like in 2.X if null)
- Additional HTTP request configurations Example:
supabase.storage.from("test").upload("test.txt", "Hello World!".encodeToByteArray()) {
contentType = ContentType.Text.Plain
upsert = true
}
- Each downloading method (downloadPublic, downloadAuthenticated, downloadPublicAsFlow, ...) now has a
options
DSL. Currently you can only configure the image transformation Example:
supabase.storage.from("test").downloadAuthenticated("test.jpg") {
transform {
size(100, 100)
}
}
- Uploading options such as
upsert
orcontentType
for resumable uploads are now getting cached. If an upload is resumed, the options from the initial upload will be used.
- Move all optional function parameters for
PostgrestQueryBuilder#select()
,insert()
,upsert()
andPostgrest#rpc()
to the request DSL by @jan-tennert in #716 Example:
supabase.from("table").upsert(myValue) {
defaultToNull = false
ignoreDuplicates = false
}
- Move the non-parameter variant of
Postgrest#rpc()
to thePostgrest
interface. It was an extension function before by @jan-tennert in #726 - Add a non-generic parameter variant of
Postgrest#rpc()
to thePostgrest
interface. This function will be called from the existing generic variant by @jan-tennert in #726 - Add a
schema
property to thePostgrest#rpc
DSL by @jan-tennert in #716 - Fix
insert
andupsert
requests failing when providing an emptyJsonObject
by @jan-tennert in #742
- Refactor internal event system for maintainability and readability by @jan-tennert #696
RealtimeChannel#presenceChangeFlow
is now a member function ofRealtimeChannel
. (It was an extension function before) by @jan-tennert in #697- Move the implementation for
RealtimeChannel#broadcastFlow
andRealtimeChannel#postgresChangeFlow
to a member function ofRealtimeChannel
. (Doesn't change anything in the public API) by @jan-tennert in #697 - Make the setter of
PostgresChangeFilter
private
- Update Kotlin to
2.0.10
- Expose
headers
andparams
inPostgrestRequestBuilder
by @jan-tennert in #689
You can now set custom headers & url parameters while making a postgrest request
-
Add support for third-party auth by @jan-tennert in #688
You can now use third-party auth providers like Firebase Auth instead of Supabase Auth by specifying a
AccessTokenProvider
in theSupabaseClientBuilder
:val supabase = createSupabaseClient(supabaseUrl, supabaseKey) { accessToken = { //fetch the third party token "my-token" } }
This will be used for the
Authorization
header and other modules like Realtime and Storage integrations! Note: TheAuth
plugin cannot be used in combination and will throw an exception if used when settingaccessToken
. -
Changes to Multi-Factor-Authentication by @jan-tennert in #681
- Refactor the syntax for enrolling MFA factors and add support for the Phone factor type:
//Enrolling a phone factor val factor = client.auth.mfa.enroll(FactorType.Phone, friendlyName) { phone = "+123456789" } //Enrolling a TOTP factor val factor = client.auth.mfa.enroll(FactorType.TOTP, friendlyName) { issuer = "Issuer" }
- Add a
channel
parameter toMfaApi#createChallenge
to allow sending phone MFA messages to eitherSMS
orWHATSAPP
. - Deprecate
MfaApi#loggedInUsingMfa
andMfaApi#isMfaEnabled
& their flow variants in favor ofMfaApi#status
andMfaApi#statusFlow
:val (enabled, active) = client.auth.mfa.status //Flow variant client.auth.mfa.statusFlow.collect { (enabled, active) -> processChange(enabled, active) }
- Refactor the syntax for enrolling MFA factors and add support for the Phone factor type:
-
Add
SlackOIDC
OAuthProvider
by @jan-tennert in #688
- Remove client-side rate-limiting in #678 by @jan-tennert
- Fix broadcasting to a private channel via the HTTP API in #673 by @jan-tennert
- Fix callbacks not getting removed correctly in the
CallbackManager
in #673 by @jan-tennert - Change internal realtime implementation to be more robust and testable in #673 by @jan-tennert
- Add
Realtime.Config#websocketFactory
: This is highly internal and should be only modified if you know what you are doing
- Add
- The
StorageApi#authenticatedRequest
method is now suspending - All uploading methods will now return a
FileUploadResponse
instead of aString
, which includes the actual path and some other properties.
- Fix deletion in
postgresListDataFlow
not working correctly by @jan-tennert in #671
- Add support for verifying a token hash by @jan-tennert in #657
- Add link to a RESTful service sample built with supabase-kt by @hieuwu in #664
- fix(realtime): add private to Realtime by @grdsdev in #642
Add support for specifying if a channel is private via
RealtimeChannelBuilder#isPrivate
- Fix Google sign in prompt in composeAuth by @Aaron246 in #648
- fix(auth): fix sign in with Apple in ComposeAuth by @grdsdev in #654
- Ignore certain status codes when signing out a user by @jan-tennert in #633 Failure of signing out because of invalid/expired JWTs will now be ignored and the local session cleared.
-
Add error code enum for Auth API errors by @jan-tennert in #618 All rest errors containing a
error_code
field will now throw aAuthRestException
rather than genericBadRequestExceptions
, etc.AuthRestException
s contain aerrorCode
field of the typeAuthErrorCode
containing all known error codes. Two error codes have their own exceptions (but obviously inherit fromAuthRestException)
:AuthWeakPasswordException
andAuthSessionMissingException
. API errors not containing this field will throw the generic exceptions. -
Handle
weak_password
andsession_not_found
auth error codes by @jan-tennert in #596 There is now a new subclass ofRestException
:AuthRestExcepton
which will be a super class for exceptions based on error codes. Currently, there are two new exceptions:AuthWeakPasswordException
andAuthSessionMissingException
-
Fix/improve session expiry calculation by @JOsacky in #610
- Add columns header to
PostgrestQueryBuilder#insert
by @jan-tennert in #611 This fixes an issue when inserting a list of objects where some objects might not have all keys. - Add
defaultToNull
parameter toPostgrestQueryBuilder#insert
- Use
Postgrest
spropertyConversionMethod
for getting the property name of primary keys - Add the possibility to have a multi-column PK in realtime by @iruizmar in #614
- Fix presences updates for
RealtimeChannel#presenceDataFlow
working incorrectly by @JOsacky in #607
- Add
isError
parameter to Compose Auth Ui fields by @jan-tennert in #612 - Add AuthUiExperimental annotation by @iruizmar in #603
All composables now have a
AuthUiExperimental
annotation instead ofSupabaseExperimental
- Update README.md by @rafalgawlik in #605
- Fix a major bug causing sessions to be refreshed later than they should be in https://github.com/supabase-community/supabase-kt/commit/af9143d6f32c9c97c38870e8bdd20863edcbc38e by @jan-tennert
The
expiresAt
property was saved incorrectly, delaying the expiry date.
- Remove OtpType deprecation notice and clarify documentation by @jan-tennert in #595
The
SIGNUP
andMAGIC_LINK
OtpType
s are no longer deprecated as they are used for resending OTPs. - Store session before emitting Authenticated state by @iruizmar in #600
This fixes a bug where it's possible to cancel any sign-in method and the
sessionStatus
gets set toAuthenticated
without the session actually saving to storage due to the cancellation.
- Fix "Login in with" typo by @JOsacky in #588
- Include columns in upsert request & change default parameter value for
defaultToNull
totrue
by @jan-tennert in #590 This fixes an issue when upserting a list of objects where some objects might not have all keys.
- Update Kotlin to 2.0.0-RC2 and Compose to 1.6.10-rc01 by @jan-tennert in #581
- Rethrow
CancellationException
s in network requests by @jan-tennert in #578 - Log the actual error if a network request fails by @jan-tennert in https://github.com/supabase-community/supabase-kt/commit/0c93053e9ddb192f7238d719617d96eb71702bfd
- Auth changes & fixes by @jan-tennert in #568
- The method
Auth#linkIdentity
will now return the OAuth URL if the config valueExternalAuthConfigDefaults.automaticallyOpenUrl
is set to false. Otherwise, null. - Fix the
autoRefresh
default value forAuth#importSession
not being set toconfig.alwaysAutoRefresh
- Add
codeVerifier
parameter toMemoryCodeVerifierCache
to be able to set an initial value - Add missing
captchaToken
config option in theOTP
auth provider
- The method
- Change the default session key for the
SettingsSessionManager
to work with multiple instances on the same device and add akey
parameter to the constructor in case you want a custom key by @MohamedRejeb in #572
- Add new experimental extension functions to retrieve initial data and listen for updates without using realtime channels by @jan-tennert #579:
//Not a suspending function, subscribing and unsubscribing is handled internally
val myProductFlow: Flow<Product> = supabase.from("products").selectSingleValueAsFlow(Product::id) {
Product::id eq 2
}.collect {
println(it)
}
val productsFlow: Flow<List<Product>> = supabase.from("products").selectAsFlow(Product::id, filter = FilterOperation("id", FilterOperator.GT, 2)).collect {
println(it)
}
This requires both Realtime
and Postgrest
to be installed within the SupabaseClient.
- Prohibit uploading empty data to a bucket by @hieuwu in #577
- Add new
region
parameter to invoke functions which allows changing the region where the Edge Function will be invoked in. Defaults toFunctions.Config#defaultRegion
(which isFunctionRegion.ANY
) by @jan-tennert in #580
- Make the default value for
Storage.Config.resumable#cache
null
to prevent a NullPointerException in testing enviroments. (If it's set to null, the default cache implementation will be used) - Fix
BucketApi#createSignedUploadUrl
returning an invalid url - Fix
BucketApi#createSignedUrl
not correctly adding transformation parameters - Fix
BucketApi#createSignedUrl
returning an invalid url - Fix
BucketListFilter#sortBy
not working correctly - Add missing
destinationBucket
parameter toBucketApi#copy
andBucketApi#move
by @jan-tennert in #562
- Move
enableLifecycleCallbacks
to the common source set (still only used on Android) by @jan-tennert in #561 - Add
AuthConfig#minimalSettings
(useful for servers or testing, disabling session storage and uses only in-memory caches) by @jan-tennert in #561
- Remove the suspend modifier for
RealtimeChannel#postgresListDataFlow
by @jan-tennert in #563 - When a postgres flow is closed, the joining payload will now be correctly cleaned by @jan-tennert in #563
- Update Kotlin to
2.0.0-RC1
- Add referenced table parameter to
or
andand
by @jan-tennert in #551 - Fix nested
or
blocks working incorrectly - Auto remove line breaks and white spaces when unquoted on Columns.Raw by @iruizmar in #544
- Add support for using GET when calling database functions by @jan-tennert in #538
There is now a
method
parameter which takes in aRpcMethod
. This can either bePOST
,HEAD
orGET
. The head parameter has been removed.
- Stabilize new flow presence and postgres methods by @jan-tennert in #535
- Stabilize linking identities and signing in anonymously by @jan-tennert in #535
- Rename
Auth#modifyUser
toAuth#updateUser
by @jan-tennert in #534 - Return full a full
UserInfo
on sign up by @jan-tennert in #528 ThesignUpWith
method will now return aUserInfo
object for theEmail
,Phone
andIDToken
instead of separate Result objects. - Allow customizing the custom tab intent on Android by @jan-tennert in #529