From 9fbb3776e8b00b02396686ecc6e07b52f9ed5e9d Mon Sep 17 00:00:00 2001 From: John Pope <109928647+wweevv-johndpope@users.noreply.github.com> Date: Fri, 7 Oct 2022 16:41:42 +1100 Subject: [PATCH] clarification on base url / service key / bearer token --- README.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 973829c..7bb2884 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,23 @@ implementation 'io.supabase:postgrest-kt:{version}' ### Initializing the client +## strings.xml +```xml + + https://1234.supabase.co/rest/v1 + db.1234.supabase.co + eyJ1234c + +``` + + ```kotlin -val postgrestClient = PostgrestDefaultClient( - uri = URI("http://localhost:3111"), - headers = mapOf("Authorization" to "foobar") + var serviceKey: String = resources.getString(R.string.supabase_key); + val postgrestClient = PostgrestDefaultClient( + uri = URI(resources.getString(R.string.base_url)), + headers = mapOf("Authorization" to "Bearer $serviceKey", "apikey" to serviceKey) ) + ``` You can also pass in a custom schema using the `schema` parameter. @@ -206,4 +218,4 @@ val postgrestClient = PostgrestClient( httpClient = customHttpClient(), jsonConverter = customConverter() ) -``` \ No newline at end of file +```