Links

Force authentication on app launch

If your mobile app has security requirements similar to that of mobile banking applications, you may want the end-users to authenticate themselves every time they use your app.
By default, the SDK stores the refresh token in a persistent storage specific to your app. The end-user signs in once and their session lasts for a long period, even if they quit the app.
You can alter this behavior by switching to a transient storage by setting the tokenStorage option to TransientTokenStorage() when configuring the SDK. The refresh token will be removed after the app is cleared, therefore authentication will be required on every app launch.
React Native
Flutter
Xamarin
iOS
Android
import authgear, { TransientTokenStorage } from "@authgear/react-native";
authgear.configure({
clientID: CLIENT_ID,
endpoint: ENDPOINT,
tokenStorage: new TransientTokenStorage(),
});
final authgear = Authgear(
clientID: CLIENT_ID,
endpoint: ENDPOINT,
tokenStorage: TransientTokenStorage(),
);
var authgearOptions = new AuthgearOptions
{
ClientId = CLIENT_ID,
AuthgearEndpoint = ENDPOINT,
TokenStorage: new TransientTokenStorage(),
};
#if __ANDROID__
var authgear = new AuthgearSdk(GetActivity().ApplicationContext, authgearOptions);
#else
#if __IOS__
var authgear = new AuthgearSdk(UIKit.UIApplication.SharedApplication, authgearOptions);
#endif
#endif
Authgear(
clientId: CLIENT_ID,
endpoint: ENDPOINT,
tokenStorage: TransientTokenStorage()
)
new Authgear(
application,
CLIENT_ID,
ENDPOINT,
new TransientTokenStorage() //tokenStorage
);