Repository navigation
fix(auth)!: throw AuthSessionMissingException when a token response has no session - #1970
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 27 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
…issingexception-when-a-sign-in-response
What
The auth methods that always return a
Sessionnow throwAuthSessionMissingExceptionwhen the server response carries no session, instead of a plainAuthExceptionwithout anerrorCode. Callers can catch the case by type or byerrorCode(session_missing) rather than matching on the message.This covers every method backed by the shared helper:
signInAnonymously,signInWithPassword,signInWithIdToken,signInWithWeb3,linkIdentityWithIdToken,passkey.verifyAuthentication(and with itsignInWithPasskeyandsignInWithRestoreKey) andrefreshSession.setInitialSessionandrecoverSession, which already reportedsession_missingfor a stored session missing data, now throw the same type too, soon AuthSessionMissingExceptioncatches everysession_missingfailure.The exception also carries the
requestIdof the response, so these call sites now userequestWithResponseto hand the helper the response headers.Breaking change
AuthSessionMissingExceptiontakes itsmessageas a named parameter, next to the newrequestId, in line with the other auth exceptions.MIGRATION.mdis updated in the existing sections that described these methods throwing anAuthExceptionandAuthSessionMissingExceptionbeing raised without a request.Refresh behavior is unchanged: the exception is still a non-retryable
AuthException, so a refresh that gets no session back signs out as before.Tests
missing_session_response_test.dartnow covers every method above and asserts the type,errorCodeandrequestId. TherefreshSessioncase starts signed in and checks that it signs out withSignOutReason.sessionExpired.Fixes SDK-2260