mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 04:15:04 +03:00
45 lines
605 B
Plaintext
45 lines
605 B
Plaintext
---
|
|
id: auth-user
|
|
title: "user()"
|
|
slug: /auth-user
|
|
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supabase_js_v2_ref.yml
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
Inside a browser context, `user()` will return the user data, if there is a logged in user.
|
|
|
|
For server-side management, you can get a user through `auth.api.getUserByCookie()`
|
|
|
|
```js
|
|
const user = supabase.auth.user()
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Notes
|
|
|
|
This method gets the user object from memory.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
### Get the logged in user
|
|
|
|
|
|
|
|
```js
|
|
const user = supabase.auth.user()
|
|
``` |