Open
Description
Bug report
Describe the bug
When calling try await client.auth.session
, it often throws GoTrue.GoTrueError.APIError(message: nil, msg: nil, code: nil, error: Optional("invalid_grant"), errorDescription: Optional("Invalid Refresh Token: Refresh Token Not Found")
and I need to manually sign in again. This happens quite often and is undesirable behavior in a production iOS app, as the user should not have to sign back in so often.
To Reproduce
- Sign in with OTP sms
- Make plenty of authenticated server requests like so:
do {
let session = try await self.supabaseClient.auth.session
let accessToken = session.accessToken
// Pass accessToken in http authorization header to custom server endpoint
}
- Eventually, after a day or so, the auth session will start throwing the refresh token error.
Expected behavior
The user should not have to log in again ever on iOS, unless they log out themselves. Meaning if you have logged in, try await client.auth.session
should always refresh itself and give a valid session assuming no other errors.
System information
- OS: [iOS 16.4.1]
- Version of gotrue-swift: [e.g. 1.1.0]
- Version of supabase-swift: [e.g. 0.2.1]