Session Duration
Para session length is configured per API key and can be set up to 30 days through the Configuration section of the or CLI. The Para API enforces the configured duration. Signing a message or transaction, or callingkeepSessionAlive(), can extend an active session according to that configuration.
Managing Sessions
Checking Session Status
UseisSessionActive() to verify whether a user’s session is currently valid before performing authenticated operations.
In React Native applications, it’s especially important to check the session status before allowing users to access authenticated areas of your app due to the persistence of local storage between app launches.
Maintaining Active Sessions
Para provides thekeepSessionAlive() method to extend an active session without requiring full reauthentication.
Refreshing Expired Sessions
When a session has expired, Para recommends initiating a full authentication flow rather than trying to refresh the session.Exporting Sessions to Your Server
UseexportSession() when you need to transfer session state to your server for performing operations on behalf of the user.
Best Practices for React Native
- Check Sessions on App Launch: Verify session status when your app starts to determine if users need to reauthenticate.
- Implement Automatic Session Extension: For long app usage sessions, periodically call
keepSessionAlive()to prevent unexpected session expirations.
- Handle Background/Foreground State: React Native apps can be backgrounded and foregrounded, which may affect session status.
- Secure Storage Configuration: For enhanced security, consider implementing a to manage sensitive session data.