Hello,
I have a web app and a mobile app developed in React Native. In the web app, when the token expires after 20 minutes, the user is automatically logged out. However, in the mobile app, I have implemented a PIN screen, and I do not want the user to be required to log in again after 20 minutes.
The app was developed 2 years ago, and the following endpoints were used:
- Login:
/api/v1/authn
- Verify MFA Code:
/api/v1/authn/factors/${data.tokenData._embedded.factors[0].id}/verify${data.apiUrl ? data.apiUrl : ''}
- Authenticate:
await authenticate({ sessionToken: sessionToken })
- The user sets the PIN with
@haskkor/react-native-pincode
When the user reopens the app, it directly goes to the PIN screen, and there is a validation process:
isAuthenticated().then(async res => {
if (res.authenticated) {
navigation.navigate('SplashScreen');
} else {
refreshTokens()
.then(res => {
navigation.navigate('SplashScreen');
})
.catch(e => {
AsyncStorage.clear().then(res => {
deleteUserPinCode();
Alert.alert(
'Error..!',
`${t('PinScreen.refresh_token_error')}`,
[{ text: 'OK', onPress: () => RNRestart.Restart() }],
);
});
});
}
});
If the user attempts to use the app after 20 minutes, I receive the following error: “Error: The refresh token is invalid or expired.”
How can I configure the React Native app to prevent the token from expiring after 20 minutes?
Thank you for your assistance.