question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

deleteUser not fire USER_DELETED event in onAuthStateChange #3049

See original GitHub issue

Bug report

Describe the bug

No USER_DELETED event is fired when a user is deleted.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Listen to supabase.auth.onAuthStateChange
  2. Delete a user.
  3. No event is triggered

Expected behavior

USER_DELETED event is fired when a user is deleted.

Additional context

USER_DELETED exists on AuthChangeEvent here: https://github.com/supabase/gotrue-js/blob/a441eef4d7291ec20b756cde99ccee87329594d0/src/lib/types.ts#L34

This a re-activation per https://github.com/supabase/supabase/issues/3049#issuecomment-1312936597

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:1
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
kangmingtaycommented, Dec 6, 2022

@j4w8n the signOut() method doesn’t have to be called with admin privileges (i.e. the service role key) compared to deleteUser.

Adding deleteUser to the GoTrueClient would be dangerous because it implies that it’s ok to be called on the client-side and users might misuse it by passing the service_role key into GoTrueClient and calling deleteUser from the browser. The GoTrueAdminApi class acts as a namespace to warn users that methods inside this class should be called strictly on the server-side with the service role key. IIRC, we kept the signOut method in GoTrueAdminApi to maintain backward compatibility and also to allow those only using the admin api to have a way to sign out their users.

1reaction
kangmingtaycommented, Dec 6, 2022

yeah @j4w8n i meant emitting 😅

Read more comments on GitHub >

github_iconTop Results From Across the Web

firebase - Deleting user from Admin API does not trigger ...
EDIT: Deleting the user from the client side does trigger .onAuthStateChanged , so from the client side it does change his/ her auth...
Read more >
onAuthStateChanged not triggered when user deleted or ...
I've got my app working with firebase.auth().onAuthStateChanged() and I'm able to create users with emails and passwords and log in as expected.
Read more >
Manage Users in Firebase - Google
Create a user. You create a new user in your Firebase project by calling the createUserWithEmailAndPassword method or by signing in a user...
Read more >
onAuthStateChanged not working ( new firebase )
Am have just updated to the latest firebase implementation but my onAuthStateChanged event does not fire anymore. I am signing in with custom...
Read more >
Using Firebase Authentication - FlutterFire
Once called, the stream provides an immediate event of the user's current ... idTokenChanges() , userChanges() & authStateChanges() will also not fire if ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found