Skip to content

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

Update initializing & improve overall documentation

Jan Tennert12a630aaac95
diff --git a/apps/docs/docs/ref/kotlin/installing.mdx b/apps/docs/docs/ref/kotlin/installing.mdx
index dba2509a17d..72e10be54fd 100644
--- a/apps/docs/docs/ref/kotlin/installing.mdx
+++ b/apps/docs/docs/ref/kotlin/installing.mdx
@@ -367,11 +367,11 @@ By default, [KotlinX Serialization](https://github.com/Kotlin/kotlinx.serializat
class CustomSerializer: SupabaseSerializer {
override fun <T : Any> encode(type: KType, value: T): String {
- //encode value to string
+ //encode value to string
}
override fun <T : Any> decode(type: KType, value: String): T {
- //decode value
+ //decode value
}
}
diff --git a/spec/supabase_kt_v0.yml b/spec/supabase_kt_v0.yml
index 5d25cf21a5b..21639c8e0e7 100644
--- a/spec/supabase_kt_v0.yml
+++ b/spec/supabase_kt_v0.yml
@@ -18,12 +18,45 @@ functions:
- id: initializing
title: 'Initializing'
description: |
+ ### Create Supabase Client
+
Independently of which Supabase module you are using, you will need to initialize the main client first and install the module.
To create a new client, you can use the `createSupabaseClient` function.
When installing a module, you can pass a block to configure it.
+ ### OAuth and OTP link verification
+
+ [supabase-kt](https://github.com/supabase-community/supabase-kt) provides several platform implementations for OAuth and OTP link verification. \
+ **On JVM**, it uses a HTTP Callback Server to receive the session data from a successful OAuth login.
+
+ *Note: OTP link verification such as sign ups are not supported on JVM. You may have to send a verification token rather than a url in your E-Mail. To send the token, rather than a redirect url, you have to change `{{ .ConfirmationURL }}` in your sign up email to `{{ .Token }}`*
+
+ **On Android, IOS & MacOS**, it uses deeplinks. Refer to the guide below on how to setup deeplinks.
+ **On JS**, it uses the website origin as the callback url. Session importing gets handled automatically.
+ **Windows & Linux** currently have no default implementation. Feel free to create a PR.
+
+ You always make your own implementation and use `gotrue.parseFragmentAndImportSession(fragment)` to let [supabase-kt](https://github.com/supabase-community/supabase-kt) handle the parsing & importing of the session after receiving a callback.
+
+ ### Configure deeplink callbacks for Authentication
+
+ Deeplinks are supported on Android, IOS and MacOS.
+ 1. **Setup a deeplink for you app** \
+ On Android you may setup a [deeplink](https://developer.android.com/training/app-links/deep-linking) in your Android manifest. \
+ On IOS & MacOS you may setup a [url scheme](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app).
+ 2. **Configure the GoTrue plugin**
+ You have to set the `host` and the `scheme` in the GoTrue config:
+ ```kotlin
+ install(GoTrue) {
+ host = "deeplink host"
+ scheme = "deeplink scheme"
+ }
+ ```
+ 3. **Call platform specific function on startup** \
+ On Android: `client.handleDeeplinks(intent)` \
+ On IOS/MacOS: `client.handleDeeplinks(url)`
+
examples:
- id: initialize-client
name: Initialize Client
@@ -2047,12 +2080,7 @@ functions:
- If **Confirm email** is enabled, the return value is null and you will be logged in instead.
- If **Confirm email** is disabled, the return value is the user and you won't be logged in automatically.
- When the user confirms their email address, they are redirected to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](https://supabase.com/dashboard/project/_/auth/url-configuration).
- - [supabase-kt](https://github.com/supabase-community/supabase-kt/) has default platform implementations:
- - On JVM, you can currently only verify a sign up through the token. To send the token, rather than a redirect url, you have to change `{{ .ConfirmationURL }}` in your sign up email to `{{ .Token }}`
- - [deep links](https://developer.android.com/training/app-links/deep-linking) (Android),
- - [url schemes](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app) (IOS)
- - To enable deeplinking/url scheme support on Android/IOS set the `host` and the `scheme` in the GoTrue Config and call `client.handleDeeplinks(intent)` (Android) and `client.handleDeeplinks(url)` (IOS) on startup
- - the website origin (JS)
+ - To learn how to handle OTP links & OAuth refer to [initializing](docs/reference/kotlin/initializing)
- If signUpWith() is called for an existing confirmed user:
- If **Confirm email** is enabled in [your project](https://supabase.com/dashboard/project/_/auth/providers), an obfuscated/fake user object is returned.
- If **Confirm email** is disabled, the error message, `User already registered` is returned.
@@ -2157,12 +2185,7 @@ functions:
- If you're using phone, you can configure whether you want the user to receive a OTP.
- The magic link's destination URL is determined by the [`SITE_URL`](/docs/reference/auth/config#site_url).
- See [redirect URLs and wildcards](/docs/guides/auth/overview#redirect-urls-and-wildcards) to add additional redirect URLs to your project.
- - [supabase-kt](https://github.com/supabase-community/supabase-kt/) has default platform implementations:
- - On JVM, you can currently only verify a OTP through the token. To send the token, rather than a redirect url, you have to change `{{ .ConfirmationURL }}` in your OTP email to `{{ .Token }}`
- - [deep links](https://developer.android.com/training/app-links/deep-linking) (Android),
- - [url schemes](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app) (IOS)
- - To enable deeplinking/url scheme support on Android/IOS set the `host` and the `scheme` in the GoTrue Config and call `client.handleDeeplinks(intent)` (Android) and `client.handleDeeplinks(url)` (IOS) on startup
- - the website origin (JS)
+ - To learn how to handle OTP links & OAuth refer to [initializing](docs/reference/kotlin/initializing)
- Magic links and OTPs share the same implementation. To send users a one-time code instead of a magic link, [modify the magic link email template](https://supabase.com/dashboard/project/_/auth/templates) to include `{{ .Token }}` instead of `{{ .ConfirmationURL }}`.
examples:
- id: sign-in-with-email
@@ -2191,12 +2214,7 @@ functions:
notes: |
- This method is used for signing in using a third-party provider.
- Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers).
- - [supabase-kt](https://github.com/supabase-community/supabase-kt/) has default platform implementations:
- - HTTP Callback Server (JVM),
- - [deep links](https://developer.android.com/training/app-links/deep-linking) (Android),
- - [url schemes](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app) (IOS)
- - To enable deeplinking/url scheme support on Android/IOS set the `host` and the `scheme` in the GoTrue Config and call `client.handleDeeplinks(intent)` (Android) and `client.handleDeeplinks(url)` (IOS) on startup
- - the website origin (JS)
+ - To learn how to handle OTP links & OAuth refer to [initializing](docs/reference/kotlin/initializing)
examples:
- id: sign-in-using-a-third-party-provider
name: Sign in using a third-party provider
@@ -2249,12 +2267,7 @@ functions:
- In case you need to use a different way to start the authentication flow with an identity provider, you can use the `SSO.withProviderId` function. For example:
- Mapping specific user email addresses with an identity provider.
- Using different hints to identity the identity provider to be used by the user, like a company-specific page, IP address or other tracking information.
- - [supabase-kt](https://github.com/supabase-community/supabase-kt/) has default platform implementations:
- - HTTP Callback Server (JVM),
- - [deep links](https://developer.android.com/training/app-links/deep-linking) (Android),
- - [url schemes](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app) (IOS)
- - To enable deeplinking/url scheme support on Android/IOS set the `host` and the `scheme` in the GoTrue Config and call `client.handleDeeplinks(intent)` (Android) and `client.handleDeeplinks(url)` (IOS) on startup
- - the website origin (JS)
+ - To learn how to handle OTP links & OAuth refer to [initializing](docs/reference/kotlin/initializing)
examples:
- id: sign-in-with-domain
@@ -3288,15 +3301,29 @@ functions:
title: removeAllChannels()
$ref: '@supabase/supabase-js.index.SupabaseClient.removeAllChannels'
notes: |
+ Unsubscribes and removes all Realtime channels from Realtime client.
- Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.
examples:
- id: remove-all-channels
name: Remove all channels
isSpotlight: true
code: |
- ```js
+ ```kotlin
client.realtime.removeAllChannels()
```
+ - id: get-channels
+ title: getChannels()
+ $ref: '@supabase/supabase-js.index.SupabaseClient.getChannels'
+ notes: |
+ Returns all Realtime channels.
+ examples:
+ - id: get-all-channels
+ name: Get all channels
+ isSpotlight: true
+ code: |
+ ```kotlin
+ val channels = client.realtime.subscriptions.entries()
+ ```
- id: list-buckets
title: listBuckets()
$ref: '@supabase/storage-js.packages/StorageBucketApi.default.listBuckets'