Skip to content

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

docs: Add anonymous sign-ins to Kotlin docs (#22320)

Jan Tennertcdc1c5adcfe5
diff --git a/apps/docs/content/guides/auth/auth-anonymous.mdx b/apps/docs/content/guides/auth/auth-anonymous.mdx
index acc247ce8f0..a7c35c2ade2 100644
--- a/apps/docs/content/guides/auth/auth-anonymous.mdx
+++ b/apps/docs/content/guides/auth/auth-anonymous.mdx
@@ -55,6 +55,15 @@ Call the [`signInAnonymously()`](/docs/reference/javascript/auth-signinanonymous
const { data, error } = await supabase.auth.signInAnonymously()
```
+</TabPanel>
+<TabPanel id="kotlin" label="Kotlin">
+
+Call the [`signInAnonymously()`](/docs/reference/kotlin/auth-signinanonymously) method:
+
+```kotlin
+supabase.auth.signInAnonymously()
+```
+
</TabPanel>
</Tabs>
@@ -79,6 +88,17 @@ You can use the [`updateUser()`](/docs/reference/javascript/auth-updateuser) met
const { data, error } = await supabase.auth.updateUser({ email: '[email protected]' })
```
+</TabPanel>
+<TabPanel id="kotlin" label="Kotlin">
+
+You can use the [`modifyUser()`](/docs/reference/kotlin/auth-updateuser) method to link an email or phone identity to the anonymous user.
+
+```kotlin
+supabase.auth.modifyUser {
+ email = "[email protected]"
+}
+```
+
</TabPanel>
</Tabs>
@@ -99,6 +119,15 @@ You can use the [`linkIdentity()`](/docs/reference/javascript/auth-linkidentity)
const { data, error } = await supabase.auth.linkIdentity({ provider: 'google' })
```
+</TabPanel>
+<TabPanel id="kotlin" label="Kotlin">
+
+You can use the [`linkIdentity()`](/docs/reference/kotlin/auth-linkidentity) method to link an oauth identity to the anonymous user.
+
+```kotlin
+supabase.auth.linkIdentity(Google)
+```
+
</TabPanel>
</Tabs>
diff --git a/apps/docs/spec/supabase_kt_v2.yml b/apps/docs/spec/supabase_kt_v2.yml
index 7215af5f062..a613cd2cbd6 100644
--- a/apps/docs/spec/supabase_kt_v2.yml
+++ b/apps/docs/spec/supabase_kt_v2.yml
@@ -2903,6 +2903,37 @@ functions:
password = "example-password"
}
```
+ - id: sign-in-anonymously
+ title: 'signInAnonymously()'
+ notes: |
+ - Creates an anonymous user.
+ - The user can be retrieved by calling `supabase.auth.currentUserOrNull()`.
+ - It is recommended to set up captcha for anonymous sign-ins to prevent abuse. You can pass in the captcha token in the `options` param.
+ params:
+ - name: captchaToken
+ isOptional: true
+ type: String?
+ description: The captcha token when having captcha enabled.
+ - name: data
+ isOptional: true
+ type: JsonObject? or T
+ description: Extra user data to pass in.
+ examples:
+ - id: sign-in-anonymously
+ name: Create an anonymous user
+ isSpotlight: true
+ code: |
+ ```kotlin
+ supabase.auth.signInAnonymously(captchaToken = "token")
+ ```
+ - id: sign-in-anonymously-with-user-metadata
+ name: Create an anonymous user with custom user metadata
+ isSpotlight: false
+ code: |
+ ```kotlin
+ supabase.auth.signInAnonymously(data = customUserData)
+ ```
+
- id: sign-in-with-password
title: 'signInWith()'
$ref: '@supabase/gotrue-js.GoTrueClient.signInWithPassword'