Files
supabase/apps/reference/_supabase_js/generated/auth-admin-getuserbyid.mdx
T
Kang Minganddng 2812617d0f docs: update auth docs for supabase-js v2 (#8648)
* docs: cleanup auth docs

* docs: update auth docs

* Update spec/supabase_js_v2_legacy.yml

Co-authored-by: dng <danny@supabase.io>

* Update spec/supabase_js_v2_legacy.yml

Co-authored-by: dng <danny@supabase.io>

* Update spec/supabase_js_v2_legacy.yml

Co-authored-by: dng <danny@supabase.io>

* Update spec/supabase_js_v2_legacy.yml

Co-authored-by: dng <danny@supabase.io>

* Update spec/supabase_js_v2_legacy.yml

Co-authored-by: dng <danny@supabase.io>

* Update spec/supabase_js_v2_legacy.yml

Co-authored-by: dng <danny@supabase.io>

* Update spec/supabase_js_v2_legacy.yml

Co-authored-by: dng <danny@supabase.io>

* Update spec/supabase_js_v2_legacy.yml

Co-authored-by: dng <danny@supabase.io>

* Update spec/supabase_js_v2_legacy.yml

Co-authored-by: dng <danny@supabase.io>

* Update spec/supabase_js_v2_legacy.yml

Co-authored-by: dng <danny@supabase.io>

* Update spec/supabase_js_v2_legacy.yml

Co-authored-by: dng <danny@supabase.io>

* Update spec/supabase_js_v2_legacy.yml

* update auth docs

* add supabase auth admin api overview page

* resolve PR comments

* resolve PR comments

* update auth docs with latest tsdocs

Co-authored-by: dng <danny@supabase.io>
2022-08-30 13:40:08 +08:00

57 lines
1.2 KiB
Plaintext

---
id: auth-admin-getuserbyid
title: 'getUserById()'
slug: /auth-admin-getuserbyid
custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml
---
import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
Get user by id.
```js
const { data, error } = await supabase.auth.admin.getUserById(1)
```
## 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's unique identifier
This function should only be called on a server. Never expose your `service_role` key in the browser.
</div>
</li>
</ul>
## Notes
- Fetches the user object from the database based on the user's id.
- The `getUserById()` method requires the user's id which maps to the `auth.users.id` column.
## Examples
### Fetch the user object using the access_token jwt.
```js
const { data, error } = await supabase.auth.admin.getUserById(1)
```