Files
supabase/apps/reference/_supabase_js/generated/auth-getuser.mdx
2022-08-16 10:57:02 +02:00

54 lines
1.1 KiB
Plaintext

---
id: auth-getuser
title: 'getUser()'
slug: /auth-getuser
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'
Gets the current user details if there is an existing session.
```js
const user = await supabase.auth.getUser()
```
## Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
jwt
</span>
<span className="method-list-item-label-badge false">
optional
</span>
<span className="method-list-item-validation">
<code>string</code>
</span>
</h4>
<div class="method-list-item-description">
Takes in an optional access token jwt. If no jwt is provided, getUser() will attempt to get the jwt from the current session.
</div>
</li>
</ul>
## Notes
This method gets the user object from memory.
## Examples
### Get the logged in user
```js
const user = await supabase.auth.getUser()
```