supabase-js icon indicating copy to clipboard operation
supabase-js copied to clipboard

React Native IOS Session Refresh

Open Garett-MacGowan opened this issue 8 months ago • 1 comments

Bug report

  • [X] I confirm this is a bug with Supabase, not with my own application.
  • [ ] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Session refresh works fine on android, but will fail on IOS if the app is backgrounded/inactive for too long.

To Reproduce

Implement refresh logic per the docs

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()
  }
})

Wait for ~1 hour, notice that user is no longer authenticated.

Expected behavior

Session refresh should work.

System information

  • Version of supabase-js: [e.g. 2.43.4]
  • Version of Node.js: [e.g. 18.18.0]

Garett-MacGowan avatar Jun 04 '24 21:06 Garett-MacGowan