JavaScript: Start auto-refresh session (non-browser)

Starts an auto-refresh process in the background. The session is checked every few seconds. Close to the time of expiration a process is started to refresh the session. If refreshing fails it will be retried for as long as necessary.

Examples

Start and stop auto refresh in React Native

import \{ AppState \} from 'react-native'

// make sure you register this only once!
AppState.addEventListener('change', (state) => \{
  if (state === 'active') \{
    supabase.auth.startAutoRefresh()
  \} else \{
    supabase.auth.stopAutoRefresh()
  \}
\})