Should API Key plugin hook removeUser?
Using the apikey plugin, if I try to remove a user with the removeUser endpoint, it fails if the user has an active API key (foreign key constraint failed). Is that expected? Do I need to manually delete the API key myself in a hook or something else first?
3 Replies
Hey this looks like a bug
just opened a PR https://github.com/better-auth/better-auth/pull/4703
GitHub
fix(api-key): Cascade api keys on user deletion by ping-maxwell · ...
When a user is about to be deleted, you run into an SQL error saying that the user has a foreign key relation to an API key, thus preventing the user from being deleted. This PR adds an onDelete e...
Thanks @Max