Repository navigation
v0.3.3 - Fix Session Restoration Endpoint
π Bug Fixes
Fixed Session Restoration Endpoint
- β
Correct endpoint - Now uses POST
/runtime/auth/verify_refresh_tokenfor session restoration - β Proper request format - Sends refresh token in request body with app-id
- β Matches React SDK - Implements same session restoration flow as official React SDK
- β
Dedicated method - New
_verifyRefreshToken()internal method for clarity
Impact: Session persistence was completely broken in v0.3.0-0.3.2. Persisted refresh tokens were being sent to the wrong endpoint (/v1/auth/me), which expects JWT access tokens.
Root Cause: Flutter SDK was using GET /v1/auth/me endpoint with refresh token as Bearer header. This endpoint is designed for authenticated user info retrieval, not session restoration. The correct endpoint is POST /runtime/auth/verify_refresh_token which accepts refresh tokens in request body.
Solution:
- Added
_verifyRefreshToken()internal method that calls correct endpoint - Updated
attemptSessionRestore()to use new method - Request format now matches React SDK:
{'app-id': appId, 'refresh-token': refreshToken}
Research Sources:
Files changed:
lib/src/auth/auth_manager.dart- Added_verifyRefreshToken(), updatedattemptSessionRestore()CHANGELOG.md- Documented the fixpubspec.yaml- Version bump to 0.3.3
Migration: No code changes required - this is a pure bug fix that enables session persistence to work correctly.
Testing: Verified against React SDK implementation and InstantDB API documentation.