Comments (15)
Now that it's 2021, curious what the preferred solution is.
there is
await supabase.auth.update({
data: {
email: '[email protected]'
},
});
however, this doesn't seem to correlate with the users.email
column.
Also, not clear how to re-trigger a confirmation email on email change.
from supabase-js.
For anyone else coming here, here is an example snippet to help:
async changeEmail(email) {
return await axios({
method: 'PUT',
url: `${SupabaseService.auth.authUrl}/user`,
headers: {
authorization: `Bearer ${SupabaseService.auth.accessToken}`,
apikey: SupabaseService.auth.supabaseKey,
},
data: {
email,
},
});
}
from supabase-js.
Also a note that we will be adding this to supabase-js - we are revising the auth API now
from supabase-js.
@tconroy for email it's const { user, error } = await supabase.auth.update({email: '[email protected]'})
This will send an email to both the user's current and new email with a confirmation link.
from supabase-js.
It's 2022, boys. Now you can do these:
- On server (with service_role key):
await supabase.auth.api.updateUserById(userId, { email: '[email protected]' })
- On client / browser, with JWT:
await supabase.auth.api.updateUser(userJwt, { email: '[email protected]' })
from supabase-js.
@rommyarb it's still 2022, but it looks like the supabase.auth.api.updateUser
method doesn't exist anymore in version 2.0+ :(
Is there an updated way to do this client-side with JWT?
from supabase-js.
Once this update happens on the client, if im updating metadata, the user object in session doesn't reflect the change
I had the same problem. It works if you refreshes the session after updating the user data.
await supabase.auth.refreshSession();
from supabase-js.
@zlwaterfield Check out Issue #21. In short, you can update user info by directly sending a request to your supabase endpoint. Supabase is using Netlify's GoTrue API to power authentication so you should be able to call any endpoint listed there using your unique supabase url and API key.
from supabase-js.
Once this update happens on the client, if im updating metadata, the user object in session doesn't reflect the change
from supabase-js.
In vue.js 3
import { supabase } from "@/clients/supabase";
const updateFirstName = async () => {
try {
const { data, error } = await supabase.auth.admin.updateUserById(userId, {
user_metadata: { first_name: firstName.value }
})
if (error) {
console.error('Error updating first name:', error);
} else {
console.log('First name updated successfully:', data);
}
} catch (error) {
console.error('Error updating first name:', error);
}
}
from supabase-js.
Awesome thanks, I'll take a look.
from supabase-js.
thanks for pitching in here @hansy
from supabase-js.
Any idea on how to restrict updates to that column for specific values?
// I want to throw an error for when a user does this, but let them update anything else
await supabase.auth.update({
data: {
read_only_property: true
},
})
from supabase-js.
You can update a logged in user client-side by calling: supabase.auth.updateUser
: https://supabase.com/docs/reference/javascript/auth-updateuser
from supabase-js.
@rommyarb it's still 2022, but it looks like the supabase.auth.api.updateUser method doesn't exist anymore in version 2.0+ :(
Hey, this can now be done from server side using this API:
supabase.auth.admin.updateUserById(userId, { email: '[email protected]' });
from supabase-js.
Related Issues (20)
- !!~GeT-NeW##@!~ fOrTnItE VbUcKs cOdEs gEnErAtOr gEt uNlImItEd fReE FoRtNiTe sKiN 2024-2025 [gS1]
- !<+get@~⚡ 950$ Free Cash App Money Generator 2024 No Human Verification [zx1]
- ^^<<free.guides]]@@~ Cash-app-money-generator-get-unlimited-free-cash-app-money 2024-2025 {wd9}
- (gEt.nOw)@!~ fReE SkInS_ fOrTnItE SkIn GeNeRaToR 2024-2025 No hUmAn vErIfIcAtIoN [mQp5]
- gEt~fAsT**~ tHe uNlImItEd fOrTnItE SkIn gEnErAtOr 2024-2025 gEt uNlImItEd fReE SkInCoDeS {iCf4}
- lAtEsT.EdItIoN@!~ fReE VbUcKs gEnErAtOr_uNlImItEd vBuCkS CoDeS 2024 rEaL MeThOd [Rv4]
- @@.lAtEsT!!vErSiOn.⚡ fReE VbUcKs GeNeRaToR 2024-2025 No hUmAn vErIfIcAtIoN [fR2]
- #+((Get_free))** Cash App Codes- Cash App Money Generator 2024-2025 Latest Us Update No Survey [op8]
- <today's Offer>!! 750$ Cash App Money Generator 2024 Claim Yours Free [lf6]
- <[nEw-uPdAtE]>@~ ThE UlTiMaTe cAsH ApP MoNeY GeNeRaToR 2024 nO VeRiFiCaTiOn [We8]
- [[(tOdAy.uPdAtEd)]]fReE ⚡ FoRtNiTe vBuCkS GeNeRaToR 2024 nO-HuMaN-VeRiFiCaTiOn-[R1G]
- ^!!{NeW.MeThOd)^~cAsH ApP MoNeY GeNeRaToR GeT UnLiMiTeD FrEe cAsH ApP MoNeY 2024-2025 [qD4]
- !!~(nEw.uPdAtEd)@@~FrEe fOrTnItE SkIn gEnErAtOr_uNlImItEd sKiNcOdEs 2024 ReAl mEtHoD [kEh1]
- {*(GeT.CoDeS)*}> ⚡ 16 dIgIt gEt fReE VbUcKs cOdEs_fOrTnItE VbUcKs cOdEs gEnErAtOr 2024-2025 nO SuRvEy [Pn6]
- LaTeSt.eDiTiOn@~ ⚡ tHe uLtImAtE FoRtNiTe sKiN GeNeRaToR 2024 cLaIm yOuRs sKiNcOdE FrEe [JaK6]
- hErE'S!!~@ ThE UnLiMiTeD VbUcKs gEnErAtOr 2024-2025 gEt uNlImItEd fReE VbUcKs cOdEs {Pk4}
- #^{<tRiCkS>}**cAsH ApP HacKed- fReE CaSh aPp mOnEy gEnErAtOr 2024-2025 uS UpDaTeD [qH5]
- #fOrTnItE SkIn⚡ FrEe sKiN- fOrTnItE SkIn gEnErAtOr 2024-2025 nO HuMaN VeRiFiCaTiOn [CrC5]
- gEt 100% FrEe** sKiN CoDeS- fOrTnItE SkIn gEnErAtOr 2024-2025 ePiC GaMeS Us uPdAtE No sUrVeY [dNb6]
- bad_jwt when auth.getUser HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from supabase-js.