amplify-js
amplify-js copied to clipboard
Auth - Offline Session Management in React Native (expired tokens while offline)
Before opening, please confirm:
- [X] I have searched for duplicate or closed issues and discussions.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
React Native
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
System:
OS: macOS 12.0.1
CPU: (10) arm64 Apple M1 Max
Memory: 74.09 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 18.7.0 - /opt/homebrew/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.15.0 - /opt/homebrew/bin/npm
Watchman: 2022.08.15.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 105.0.5195.125
Firefox: 105.0.1
Safari: 15.1
npmPackages:
@novu/node: ^0.8.0 => 0.8.0
amqp-connection-manager: ^3.8.1 => 3.8.1
amqplib: ^0.8.0 => 0.8.0
amqplib-tutorials: 0.0.1
npmGlobalPackages:
@aws-amplify/cli: 9.0.0
@nestjs/cli: 8.2.6
aws-cdk: 2.43.0
eas-cli: 0.54.1
envinfo: 7.8.1
expo-cli: 5.4.6
n: 8.0.0
netlify-cli: 8.0.15
npm: 8.15.0
nx: 13.4.5
plop: 3.0.5
react-devtools: 4.24.3
ts-node: 10.8.1
typeorm: 0.3.6
typescript: 4.5.2
vercel: 28.2.2
Describe the bug
Hi all
We are experiencing session issues with our mobile apps, when our users are offline and the id/access token has expired.
id + access token have expiration of 60min and refresh token of 90 days
We would be interested how others are handling this situation:
- When a user is offline / has no internet connection and resumes the app after the id + access token have expired, the session is dropped and the user is logged out
- How can we avoid this behavior as it is a big pain point?
Would appreciate any feedback
Expected behavior
While user is offline and id + access tokens have expired:
const session = Auth.currentSession()
Reproduction steps
- Go into airplaine mode
- Close app
- Wait until tokens have expired
- Open app
Code Snippet
const session = Auth.currentSession()
Log output
// Put your logs below this line
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response