Skip to content

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

starting to update all examples

Copplec254ab858128
diff --git a/spec/supabase_js_v2_legacy.yml b/spec/supabase_js_v2_legacy.yml
index 44e9c85b242..66ed513dd30 100644
--- a/spec/supabase_js_v2_legacy.yml
+++ b/spec/supabase_js_v2_legacy.yml
@@ -79,38 +79,16 @@ pages:
auth.signInWithPassword():
title: 'signInWithPassword()'
$ref: '@supabase/gotrue-js.GoTrueClient.signInWithPassword'
- notes: |
- - A user can sign up either via email or OAuth.
- - If you provide `email` without a `password`, the user will be sent a magic link.
- - The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com)
- - Specifying a `provider` will open the browser to the relevant login page.
examples:
- name: Sign in with email.
isSpotlight: true
js: |
```js
- const { user, session, error } = await supabase.auth.signIn({
+ const { user, session, error } = await supabase.auth.signInWithPassword({
password: 'example-password',
})
```
- - name: Sign in with magic link.
- description: If no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds.
- js: |
- ```js
- const { user, session, error } = await supabase.auth.signIn({
- })
- ```
- - name: Sign in using third-party providers.
- description: Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers).
- js: |
- ```js
- const { user, session, error } = await supabase.auth.signIn({
- // provider can be 'github', 'google', 'gitlab', and more
- provider: 'github'
- })
- ```
- name: Sign in with Phone.
description: Supabase supports Phone Auth.
js: |
@@ -129,44 +107,12 @@ pages:
any URL path on your website (the URL must either be on the same domain as your Site URL [see Auth>Settings in dashboard], or must match one of the Additional Redirect URLs [also in Auth>Settings]).
js: |
```js
- const { user, session, error } = await supabase.auth.signIn({
+ const { user, session, error } = await supabase.auth.signInWithPassword({
provider: 'github'
}, {
redirectTo: 'https://example.com/welcome'
})
```
- - name: Sign in with scopes.
- description: |
- If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token.
- You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider.
- js: |
- ```js
- const { user, session, error } = await supabase.auth.signIn({
- provider: 'github'
- }, {
- scopes: 'repo gist notifications'
- })
- const oAuthToken = session.provider_token // use to access provider API
- ```
- - name: Sign in using a refresh token (e.g. in React Native).
- description: |
- If you are completing a sign up or login in a React Native app you can pass the refresh token obtained from the provider to obtain a session.
- js: |
- ```js
- // An example using Expo's `AuthSession`
- const redirectUri = AuthSession.makeRedirectUri({ useProxy: false });
- const provider = 'google';
-
- AuthSession.startAsync({
- authUrl: `https://MYSUPABASEAPP.supabase.co/auth/v1/authorize?provider=${provider}&redirect_to=${redirectUri}`,
- returnUrl: redirectUri,
- }).then(async (response: any) => {
- if (!response) return;
- const { user, session, error } = await supabase.auth.signIn({
- refreshToken: response.params?.refresh_token,
- });
- });
- ```
auth.signInWithOtp():
title: 'signInWithOtp()'