Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: update Kotlin docs (#36718)

Jan Tennertcfedfc974a9d
diff --git a/apps/docs/docs/ref/kotlin/installing.mdx b/apps/docs/docs/ref/kotlin/installing.mdx
index 93a918c49ff..5c4a05158b2 100644
--- a/apps/docs/docs/ref/kotlin/installing.mdx
+++ b/apps/docs/docs/ref/kotlin/installing.mdx
@@ -151,25 +151,25 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab
<TabPanel id="kotlin" label="build.gradle.kts">
```kotlin
- val commonMain by getting {
+ commonMain {
dependencies {
- //supabase modules
+ //Supabase modules
}
}
- val jvmMain by getting {
+ jvmMain {
dependencies {
implementation("io.ktor:ktor-client-cio:KTOR_VERSION")
}
}
- val androidMain by getting {
- dependsOn(jvmMain)
+ androidMain {
+ dependsOn(jvmMain.get())
}
- val jsMain by getting {
+ jsMain {
dependencies {
implementation("io.ktor:ktor-client-js:KTOR_VERSION")
}
}
- val iosMain by getting {
+ iosMain {
dependencies {
implementation("io.ktor:ktor-client-darwin:KTOR_VERSION")
}
diff --git a/apps/docs/spec/supabase_kt_v3.yml b/apps/docs/spec/supabase_kt_v3.yml
index 3aa366b00f3..f6a4988ea72 100644
--- a/apps/docs/spec/supabase_kt_v3.yml
+++ b/apps/docs/spec/supabase_kt_v3.yml
@@ -3720,9 +3720,11 @@ functions:
$ref: '@supabase/gotrue-js.GoTrueClient.onAuthStateChange'
notes: |
Listen to session changes.
+ - `sessionStatus` is a `Flow<SessionStatus>` that emits the current session status. Everything related to the session is handled by this flow.
+ - `events` is a `Flow<AuthEvent>` that emits auth events. This flow is used to listen to auth events that are independent of the current session, like OTP errors, refresh failures, etc. Experimental.
examples:
- id: listen-to-auth-changes
- name: Listen to auth changes
+ name: Listen to session status changes
isSpotlight: true
code: |
```kotlin
@@ -3742,7 +3744,9 @@ functions:
}
}
SessionStatus.Initializing -> println("Initializing")
- is SessionStatus.RefreshFailure -> println("Refresh failure ${it.cause}") //Either a network error or a internal server error
+ is SessionStatus.RefreshFailure -> {
+ println("Session expired and could not be refreshed")
+ }
is SessionStatus.NotAuthenticated -> {
if(it.isSignOut) {
println("User signed out")
@@ -3759,6 +3763,20 @@ functions:
- `Initializing`,
- `RefreshFailure(cause)`,
- `Authenticated(session, source)`
+ - id: listen-to-events
+ name: Listen to auth events
+ isSpotlight: false
+ code: |
+ ```kotlin
+ supabase.auth.events.collect {
+ when(it) {
+ is AuthEvent.OtpError ->
+ println("Found error in current URL / deeplink during the OAuth flow: ${it.error}")
+ is AuthEvent.RefreshFailure ->
+ println("Failed to refresh session: ${it.error}")
+ }
+ }
+ ```
- id: reset-password-for-email
title: 'Send a password reset request'
notes: |
@@ -4053,7 +4071,7 @@ functions:
supabaseKey = "supabaseKey"
) {
install(Auth) {
- minimalSettings() //disables session saving and auto-refreshing
+ minimalConfig() //disables session saving and auto-refreshing
}
// install other plugins (these will use the service role key)
}