Skip to content

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

docs: Adds some init code for gotruejs

Paul Copplestone65adf3bbe6c0
diff --git a/web/docs/gotrue/client/initializing.mdx b/web/docs/gotrue/client/initializing.mdx
index 81cd1185b72..a288522ec3e 100644
--- a/web/docs/gotrue/client/initializing.mdx
+++ b/web/docs/gotrue/client/initializing.mdx
@@ -9,7 +9,33 @@ import TabItem from '@theme/TabItem';
Create a new client for use in the browser.
+<Tabs
+ defaultValue="js"
+ groupId="libraries"
+ values={[{ label: 'JavaScript', value: 'js' },{ label: 'Python', value: 'py' }]}>
+<TabItem value="js">
+
+```js
+import { GoTrueClient } from '@supabase/gotrue-js'
+
+const auth = new GoTrueClient({
+ url: "https://your-gotrue-url.com"
+})
+```
+
+
+</TabItem>
+<TabItem value="py">
+
+```py
+# Not yet implemented
+```
+
+
+</TabItem>
+
+</Tabs>
## Parameters
@@ -40,18 +66,18 @@ No description provided.
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
- url
+ autoRefreshToken
</span>
<span className="method-list-item-label-badge false">
optional
</span>
<span className="method-list-item-validation">
- |
+ | |
</span>
</h4>
<div class="method-list-item-description">
-The URL of the GoTrue server.
+Set to "true" if you want to automatically refresh the token before expiring.
</div>
@@ -61,7 +87,7 @@ The URL of the GoTrue server.
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
- persistSession
+ detectSessionInUrl
</span>
<span className="method-list-item-label-badge false">
optional
@@ -72,7 +98,7 @@ The URL of the GoTrue server.
</h4>
<div class="method-list-item-description">
-Set to "true" if you want to automatically save the user session into local storage.
+Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
</div>
@@ -82,18 +108,18 @@ Set to "true" if you want to automatically save the user session into local stor
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
- localStorage
+ headers
</span>
<span className="method-list-item-label-badge false">
optional
</span>
<span className="method-list-item-validation">
- Storage
+ |
</span>
</h4>
<div class="method-list-item-description">
-No description provided.
+Any additional headers to send to the GoTrue server.
</div>
@@ -103,18 +129,18 @@ No description provided.
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
- headers
+ localStorage
</span>
<span className="method-list-item-label-badge false">
optional
</span>
<span className="method-list-item-validation">
- |
+ Storage
</span>
</h4>
<div class="method-list-item-description">
-Any additional headers to send to the GoTrue server.
+No description provided.
</div>
@@ -124,7 +150,7 @@ Any additional headers to send to the GoTrue server.
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
- detectSessionInUrl
+ persistSession
</span>
<span className="method-list-item-label-badge false">
optional
@@ -135,7 +161,7 @@ Any additional headers to send to the GoTrue server.
</h4>
<div class="method-list-item-description">
-Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
+Set to "true" if you want to automatically save the user session into local storage.
</div>
@@ -145,18 +171,18 @@ Set to "true" if you want to automatically detects OAuth grants in the URL and s
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
- autoRefreshToken
+ url
</span>
<span className="method-list-item-label-badge false">
optional
</span>
<span className="method-list-item-validation">
- | |
+ |
</span>
</h4>
<div class="method-list-item-description">
-Set to "true" if you want to automatically refresh the token before expiring.
+The URL of the GoTrue server.
</div>
@@ -166,4 +192,51 @@ Set to "true" if you want to automatically refresh the token before expiring.
</li>
-</ul>
\ No newline at end of file
+</ul>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Examples
+
+### Initialize a GoTrue client
+
+
+
+<Tabs
+ defaultValue="js"
+ groupId="libraries"
+ values={[{ label: 'JavaScript', value: 'js' },{ label: 'Python', value: 'py' }]}>
+
+<TabItem value="js">
+
+```js
+import { GoTrueClient } from '@supabase/gotrue-js'
+
+const auth = new GoTrueClient({
+ url: "https://your-gotrue-url.com"
+})
+```
+
+
+</TabItem>
+<TabItem value="py">
+
+```py
+# Not yet implemented
+```
+
+
+</TabItem>
+
+</Tabs>
\ No newline at end of file
diff --git a/web/spec/gotrue.yml b/web/spec/gotrue.yml
index d991fc91d48..6db3c28facc 100644
--- a/web/spec/gotrue.yml
+++ b/web/spec/gotrue.yml
@@ -64,6 +64,21 @@ pages:
Initializing:
$ref: '"GoTrueClient".GoTrueClient.constructor'
+ examples:
+ - name: Initialize a GoTrue client
+ isSpotlight: true
+ js: |
+ ```js
+ import { GoTrueClient } from '@supabase/gotrue-js'
+
+ const auth = new GoTrueClient({
+ url: "https://your-gotrue-url.com"
+ })
+ ```
+ py: |
+ ```py
+ # Not yet implemented
+ ```
signUp:
$ref: '"GoTrueClient".GoTrueClient.signUp'