---
id: auth-onauthstatechange
title: "onAuthStateChange()"
slug: auth-onauthstatechange
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supabase.yml
---

import Tabs from '@theme/Tabs';
import TabsPanel from '@theme/TabsPanel';

Receive a notification every time an auth event happens.

<Tabs
  defaultActiveId="js"
  groupId="reference/supabase-js"
  values={[{ label: 'JavaScript', value: 'js' }]}>

<TabsPanel id="js" label="js">

```js
supabase.auth.onAuthStateChange((event, session) => {
  console.log(event, session)
})
```


</TabsPanel>

</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">
      callback
    </span>
    <span className="method-list-item-label-badge required">
      required
    </span>
    <span className="method-list-item-validation">
      <code>object</code>
    </span>
  </h4>
  <div class="method-list-item-description">

No description provided. 

  </div>
  
</li>

</ul>














## Examples

### Listen to auth changes



<Tabs
  defaultActiveId="js"
  groupId="reference/supabase-js"
  values={[{ label: 'JavaScript', value: 'js' }]}>

<TabsPanel id="js" label="js">

```js
supabase.auth.onAuthStateChange((event, session) => {
  console.log(event, session)
})
```


</TabsPanel>

</Tabs>