Skip to content

Conversation

ftonato
Copy link
Contributor

@ftonato ftonato commented Sep 14, 2021

What kind of change does this PR introduce?

Refactor our codebase creating a new type to avoid repeat ourselves and add the correct return type for createClient method

@adam-beck
Copy link
Contributor

Wouldn't Record<string, string> accomplish the same thing? And, since it's a built-in utility type, it would be easier to read and understand.

@ftonato
Copy link
Contributor Author

ftonato commented Sep 16, 2021

Wouldn't Record<string, string> accomplish the same thing? And, since it's a built-in utility type, it would be easier to read and understand.

You're totally right, they both do the same, it's just a matter of custom for those who have been using TS since before version 2.1 (which is when the records arrived) 🐶

About being easier to read, to me they both seem simple (again, seems like a particular preference)

@ftonato ftonato requested a review from w3b6x9 January 20, 2022 23:49
Co-authored-by: Wen Bo Xie <5532241+w3b6x9@users.noreply.github.com>
@ftonato ftonato requested a review from w3b6x9 January 21, 2022 00:11
@ftonato
Copy link
Contributor Author

ftonato commented Jan 21, 2022

@w3b6x9 First and last time I try to resolve conflict by browser (using the mobile) hahaha

@ftonato ftonato requested a review from w3b6x9 January 21, 2022 00:17
@w3b6x9
Copy link
Member

w3b6x9 commented Jan 21, 2022

@w3b6x9 First and last time I try to resolve conflict by browser hahaha

haha wow mobile browser...that's quite the challenge!

Copy link
Member

@w3b6x9 w3b6x9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks!

@w3b6x9 w3b6x9 merged commit e4d41d5 into supabase:master Jan 21, 2022
mandarini pushed a commit that referenced this pull request Oct 2, 2025
## What kind of change does this PR introduce?
* Supercedes #258
* Adds `reauthenticate()` method to allow a user to request for a nonce
to subsequently update their password
* Updates the type for `UserAttributes` which is used in `updateUser()`
to include the `nonce`
* If a nonce is not passed into `updateUser()`, an
`AuthSessionMissingError()` will be returned

## Details
With this addition, the update password flow will look like the
following when "Secure password change" is enabled on the Supabase
dashboard. For users that are self-hosting gotrue and using gotrue-js,
this requires setting the environmentr variable,
`GOTRUE_SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION="true"`
```

// Send reauthentication to the current user. User must be signed-in to perform this action.
await supabase.auth.reauthenticate()

// Update password 
await supabase.auth.updateUser({ password: "new-pasword", "nonce": "123456" }
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants