Files
supabase/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-deleteuser.mdx
2022-08-13 22:24:54 +08:00

83 lines
1.6 KiB
Plaintext

---
id: auth-api-deleteuser
title: 'deleteUser()'
slug: auth-api-deleteuser
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supabase.yml
---
import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
Delete a user. Requires a `service_role` key.
This function should only be called on a server. Never expose your `service_role` key in the browser.
<Tabs
defaultValue="js"
groupId="reference/supabase-js"
values={[{ label: 'JavaScript', value: 'js' }]}>
<TabItem value="js">
```js
const { data: user, error } = await supabase.auth.api.deleteUser(
'715ed5db-f090-4b8c-a067-640ecee36aa0'
)
```
</TabItem>
</Tabs>
## Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
uid
</span>
<span className="method-list-item-label-badge required">
required
</span>
<span className="method-list-item-validation">
<code>string</code>
</span>
</h4>
<div class="method-list-item-description">
The user uid you want to remove.
</div>
</li>
</ul>
## Notes
- Requires a `service_role` key.
- This function should be called on a server. Never expose your `service_role` key in the browser.
## Examples
### Remove a user completely.
<Tabs
defaultValue="js"
groupId="reference/supabase-js"
values={[{ label: 'JavaScript', value: 'js' }]}>
<TabItem value="js">
```js
const { data: user, error } = await supabase.auth.api.deleteUser(
'715ed5db-f090-4b8c-a067-640ecee36aa0'
)
```
</TabItem>
</Tabs>