Comments (13)
Are you trying to update the user on your server vs on the client? I can get this error when I try the updateUser when I am on the server because the session is stored in localStorage.
You can theoretically do it on the server with supabase.auth.admin.updateUserById(user_id, {email: usersNewEmail}) but that doesn't seem to be converting the users from being anonymous which I can't tell if that is by design or a bug - it adds the email fine but the user is still considered anonymous.
from supabase.
Yes I know that. I was trying to troubleshoot where the user was having issues because I can't reproduce. I'm using anonymous users and update user works just fine - the only way I've managed to get the posted error is trying to call the method from the server which returns that error (as expected) since there isn't a session on the server.
from supabase.
@encima Sorry I think I mis-read your comment this morning are you saying
supabase.auth.admin.updateUserById
is not supposed to convert a user from Anonymous to Email if you assign an email with email_confirm = true? If so why is that the design? How can a user be converted from anonymous to email without sending a confirmation email and without turning off email confirmation completely?
That might be a separate discussion :)
Converting anonymous to user is done as you said, using the client side. The server side call is for generally updating a user (changing not just the email).
from supabase.
@encima new issue opened supabase/auth#1578 if you want to take a look.
from supabase.
If I execute the updateUser call on the client, it works as expected. This was not clear to me from the documentation.
from supabase.
Thanks @r-southworth, the call you mention is by design as this existed before anonymous users and is used in other user update operations. The method in the docs is the way to create a user from anonymouse
from supabase.
@encima Sorry I think I mis-read your comment this morning are you saying supabase.auth.admin.updateUserById
is not supposed to convert a user from Anonymous to Email if you assign an email with email_confirm = true? If so why is that the design? How can a user be converted from anonymous to email without sending a confirmation email and without turning off email confirmation completely?
from supabase.
@gitnik I can't reproduce with supabase-js 2.42.0 or 2.43.1 I am calling supabase.auth.getUser()
between signInAnonymously
and updateUser
so in at least some situations it seems to be working. Maybe test if the getUser matters at all in your implementation? Also the session should be created in local storage as soon as you call signInAnonymously
which is working for me - have you inspected your localStorage to see if the session is being created?
from supabase.
I am running into an issue, that I am not sure is related or not, but I am using anonymous users on the server and they work as you'd expect, but I can't convert them to permanent user, using otp. The otp is always expired or is invalid, and i've made sure it's correct multiple times.
signing up normally works with otp.
Also I tried on the client and still have the same problem or is there something I am missing?
So far I am signing in anonymously on the server, updating on client and verifying the token on the client using supabase ssr, I also tried with the supabase-js with no ssr but still doesn't work. Updating on the server doesn't work either that was my initial approach, switched to client after reading this thread.
from supabase.
@OmarGoubail I think you might need to do something with linked identities to get Otp to work. Like sign up the user with otp then call a manual link method to combine that with the anonymous user - but that isn't really covered in the docs at this point so I am not entirely sure
from supabase.
@r-southworth Thanks for the quick reply, I wanted to to confirm all possible methods before replying.
Manual linking doesn't work like that as far as I can tell, it need oAuth, and I am trying to authenticate using email only.
My problem, which I am more confident now is a bug, is that otp is always expired or incorrect when using anonymous sign-ins. So far I've tried normal sign up in which otp works normally. I've tried using admin method to confirm email then re authenticating but otp is always expired. if I use {{ .ConfirmationURL }} with update user, then user is converted with no problems.
So I can't convert anonymous with otp in all cases I am aware of, I am hoping it's something am missing. So will open a detailed issue when I can.
from supabase.
@OmarGoubail Did you try a combo of signing up with otp then updateUser on the anonymous user with the same email? If I understand automatic linking correctly (which is dubious - but best guess anyway) then once the anonymous user confirms their email the otp user and the now not-anonymous user should get merged.
from supabase.
@r-southworth If I understand you correctly. First you sign-in anonymously then you sign up without pushing a cookie correct? then afterwards you just update the email with auth.updateUser(), and they will be automatically linked. But wouldn't that have the same problem because updating user requires an otp verification which will be also expired or incorrect?
from supabase.
Related Issues (20)
- Escaped quotes are being added around the email sender name HOT 3
- Cannot Mint Custom JWT in Python HOT 16
- MISSING JWT FIELD DOCUMENTATION HOT 2
- database not updating via table editor HOT 1
- Missing `await` in samples cause node app to crash? HOT 3
- 'Connect to your project' Nuxt and Vue framework example code issue
- Sign in with Apple (signInWithIdToken) : error 400 HOT 7
- New column not recognized HOT 1
- Application error: a client-side exception has occurred (see the browser console for more information) HOT 2
- Unable to Connect GitHub Repository to Multiple Supabase Accounts Using a Single GitHub Account HOT 7
- Bad element positioning in project page's sidebar HOT 4
- Storage bucket .emptyFolderPlaceholder created when using the Supabase Dashboard HOT 1
- TUS uploads to user protected folders.
- API Gateway and postgresql logging not working for local development HOT 35
- Auth Custom Claims Guide: Multiple roles per user? HOT 1
- SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing HOT 2
- JWT secret should be generated client-side only HOT 3
- supabase functions deploy failure HOT 1
- Role impersonation UI does not change role used in GraphiQL queries on local environment HOT 2
- Request timeout on Supabase Edge Functions when using grammy/conversations
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.