Skip to content

Commit

Permalink
chore: merge upstream updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jingsam committed Aug 27, 2024
2 parents 23b1744 + 95b3ed1 commit 3910d76
Show file tree
Hide file tree
Showing 36 changed files with 881 additions and 63 deletions.
37 changes: 37 additions & 0 deletions apps/docs/content/guides/auth/auth-anonymous.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ Call the [`signInAnonymously()`](/docs/reference/kotlin/auth-signinanonymously)
supabase.auth.signInAnonymously()
```

</TabPanel>
<TabPanel id="python" label="Python">

Call the [`sign_in_anonymously()`](/docs/reference/python/auth-signinanonymously) method:

```python
response = supabase.auth.sign_in_anonymously()
```

</TabPanel>
</Tabs>

Expand Down Expand Up @@ -141,6 +150,25 @@ supabase.auth.modifyUser {
}
```

</TabPanel>
<TabPanel id="python" label="Python">

You can use the [`update_user()`](/docs/reference/python/auth-updateuser) method to link an email or phone identity to the anonymous user. To add a password for the anonymous user, the user's email or phone number needs to be verified first.

```python
response = supabase.auth.update_user({
'email': '[email protected]',
})

# verify the user's email by clicking on the email change link
# or entering the 6-digit OTP sent to the email address

# once the user has been verified, update the password
response = supabase.auth.update_user({
'password': 'password',
})
```

</TabPanel>
</Tabs>

Expand Down Expand Up @@ -188,6 +216,15 @@ You can use the [`linkIdentity()`](/docs/reference/kotlin/auth-linkidentity) met
supabase.auth.linkIdentity(Google)
```

</TabPanel>
<TabPanel id="python" label="Python">

You can use the [`link_identity()`](/docs/reference/python/auth-linkidentity) method to link an oauth identity to the anonymous user.

```python
response = supabase.auth.link_identity({'provider': 'google'})
```

</TabPanel>
</Tabs>

Expand Down
38 changes: 38 additions & 0 deletions apps/docs/content/guides/auth/auth-email-passwordless.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,20 @@ suspend fun signInWithEmail() {
}
```

</TabPanel>
<TabPanel id="python" label="Python">

```python
response = supabase.auth.sign_in_with_otp({
'email': '[email protected]',
'options': {
# set this to false if you do not want the user to be automatically signed up
'should_create_user': False,
'email_redirect_to': 'https://example.com/welcome',
},
})
```

</TabPanel>
</Tabs>

Expand Down Expand Up @@ -206,6 +220,19 @@ suspend fun signInWithEmailOtp() {
}
```

</TabPanel>
<TabPanel id="python" label="Python">

```python
response = supabase.auth.sign_in_with_otp({
'email': '[email protected]',
'options': {
# set this to false if you do not want the user to be automatically signed up
'should_create_user': False,
},
})
```

</TabPanel>
</Tabs>

Expand Down Expand Up @@ -265,6 +292,17 @@ try await supabase.auth.verifyOTP(
supabase.auth.verifyEmailOtp(type = OtpType.Email.EMAIL, email = "email", token = "151345")
```

</TabPanel>
<TabPanel id="python" label="Python">

```python
response = supabase.auth.verify_otp({
'email': email,
'token': '123456',
'type': 'email',
})
```

</TabPanel>
</Tabs>

Expand Down
26 changes: 26 additions & 0 deletions apps/docs/content/guides/auth/auth-identity-linking.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ Supabase Auth allows a user to initiate identity linking with a different email
supabase.auth.linkIdentity(Google)
```

</TabPanel>
<TabPanel id="python" label="Python">

Supabase Auth allows a user to initiate identity linking with a different email address when they are logged in. To link an OAuth identity to the user, call [`link_identity()`](/docs/reference/python/auth-linkidentity):

```python
response = supabase.auth.link_identity({'provider': 'google'})
```

</TabPanel>
</Tabs>

Expand Down Expand Up @@ -144,5 +153,22 @@ val googleIdentity = identities.first { it.provider == "google" }
supabase.auth.unlinkIdentity(googleIdentity.identityId!!)
```

</TabPanel>
<TabPanel id="python" label="Python">

You can use [`get_user_identities()`](/docs/reference/python/auth-getuseridentities) to fetch all the identities linked to a user. Then, call [`unlink_identity()`](/docs/reference/python/auth-unlinkidentity) to unlink the identity. The user needs to be logged in and have at least 2 linked identities in order to unlink an existing identity.

```python
# retrieve all identities linked to a user
response = supabase.auth.get_user_identities()

# find the google identity linked to the user
google_identity = next((identity for identity in response.identities if identity.provider == 'google'), None)

# unlink the google identity from the user
if google_identity:
response = supabase.auth.unlink_identity(google_identity.identity_id)
```

</TabPanel>
</Tabs>
100 changes: 100 additions & 0 deletions apps/docs/content/guides/auth/passwords.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,25 @@ suspend fun signUpNewUser() {
}
```

</TabPanel>
<TabPanel id="python" label="Python">

To sign up the user, call [signUp()](/docs/reference/python/auth-signup) with their email address and password.

You can optionally specify a URL to redirect to after the user clicks the confirmation link. This URL must be configured as a [Redirect URL](/docs/guides/auth/redirect-urls), which you can do in the [dashboard](/dashboard/project/_/auth/url-configuration) for hosted projects, or in the [configuration file](/docs/guides/cli/config#auth.additional_redirect_urls) for self-hosted projects.

If you don't specify a redirect URL, the user is automatically redirected to your site URL. This defaults to `localhost:3000`, but you can also configure this.

```python
data = await supabase.auth.sign_up({
'email': '[email protected]',
'password': 'example-password',
'options': {
'email_redirect_to': 'https://example.com/welcome',
},
})
```

</TabPanel>
</Tabs>

Expand Down Expand Up @@ -411,6 +430,18 @@ suspend fun signUpNewUser() {
}
```
</TabPanel>
<TabPanel id="python" label="Python">
To sign up the user, call [signUp()](/docs/reference/python/auth-signup) with their email address and password:
```python
data = supabase.auth.sign_up({
'email': '[email protected]',
'password': 'example-password',
})
```
</TabPanel>
</Tabs>
Expand Down Expand Up @@ -479,6 +510,18 @@ suspend fun signInWithEmail() {
}
```
</TabPanel>
<TabPanel id="python" label="Python">
When your user signs in, call [sign_in_with_password()](/docs/reference/python/auth-signinwithpassword) with their email address and password:
```python
data = client.auth.sign_in_with_password({
'email': '[email protected]',
'password': 'example-password',
})
```
</TabPanel>
</Tabs>
Expand Down Expand Up @@ -535,6 +578,16 @@ supabase.gotrue.sendRecoveryEmail(
If you are on one of the Kotlin targets that have built-in support for redirect URL handling, such as Android, see [OAuth and OTP link verification](https://supabase.com/docs/reference/kotlin/initializing).
</TabPanel>
<TabPanel id="python" label="Python">
```python
client.auth.reset_password_email(
'[email protected]',
{'redirect_to':'http://example.com/account/update-password'}
)
```
</TabPanel>
</Tabs>
Expand Down Expand Up @@ -812,6 +865,13 @@ supabase.gotrue.sendRecoveryEmail(
)
```
</TabPanel>
<TabPanel id="python" label="Python">
```python
supabase.auth.reset_password_email('[email protected]')
```
</TabPanel>
</Tabs>
Expand Down Expand Up @@ -850,6 +910,13 @@ supabase.auth.updateUser {
}
```
</TabPanel>
<TabPanel id="python" label="Python">
```python
supabase.auth.update_user({'password': 'new_password'})
```
</TabPanel>
</Tabs>
Expand Down Expand Up @@ -936,6 +1003,16 @@ supabase.auth.signUpWith(Phone) {
}
```
</TabPanel>
<TabPanel id="python" label="Python">
```python
supabase.auth.sign_up({
'phone': "+13334445555",
'password': "some-password"
})
```
</TabPanel>
<TabPanel id="http" label="HTTP">
Expand Down Expand Up @@ -1002,6 +1079,19 @@ supabase.auth.verifyPhoneOtp(
)
```
</TabPanel>
<TabPanel id="python" label="Python">
You should present a form to the user so they can input the 6 digit pin, then send it along with the phone number to `verify_otp`:
```python
supabase.auth.verify_otp({
'phone': "+13334445555",
'token': "123456",
'type': "sms"
})
```
</TabPanel>
<TabPanel id="http" label="HTTP">
Expand Down Expand Up @@ -1059,6 +1149,16 @@ supabase.auth.signInWith(Phone) {
}
```
</TabPanel>
<TabPanel id="python" label="Python">
```python
supabase.auth.sign_in_with_password({
'phone': "+13334445555"
'password': "some-password"
})
```
</TabPanel>
<TabPanel id="http" label="HTTP">
Expand Down
31 changes: 31 additions & 0 deletions apps/docs/content/guides/auth/phone-login.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ supabase.auth.signInWith(OTP) {
}
```

</TabPanel>
<TabPanel id="python" label="Python">

```python
response = supabase.auth.sign_in_with_otp({
'phone': '+13334445555',
})
```

</TabPanel>
<TabPanel id="http" label="HTTP">

Expand Down Expand Up @@ -133,6 +142,19 @@ supabase.auth.verifyPhoneOtp(
)
```

</TabPanel>
<TabPanel id="python" label="Python">

You should present a form to the user so they can input the 6 digit pin, then send it along with the phone number to `verify_otp`:

```python
response = supabase.auth.verify_otp({
'phone': '13334445555',
'token': '123456',
'type': 'sms',
})
```

</TabPanel>
<TabPanel id="http" label="HTTP">

Expand Down Expand Up @@ -193,6 +215,15 @@ try await supabase.auth.updateUser(
)
```

</TabPanel>
<TabPanel id="python" label="Python">

```python
response = supabase.auth.update_user({
'phone': '123456789',
})
```

</TabPanel>
</Tabs>

Expand Down
7 changes: 7 additions & 0 deletions apps/docs/content/guides/auth/signout.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ suspend fun logout() {
}
```

</TabPanel>
<TabPanel id="python" label="Python">

```python
supabase.auth.sign_out()
```

</TabPanel>
</Tabs>

Expand Down
Loading

0 comments on commit 3910d76

Please sign in to comment.