static Future<AmityUser> amityLogin(String? userID, String? userName) async {
var authToken = await getAuthTokenFromBackendAPI();
await AmityUserTokenManager(
apiKey: 'AMITY_API_KEY',
endpoint: AmityRegionalHttpEndpoint.US)
.createUserToken(userID ?? '',
displayname: userName, secureToken: authToken)
.then((AmityUserToken token) {
log('accessToken = ${token.accessToken}');
}, onError: (error) {
return error;
});
return await AmityCoreClient.login(userID ?? '')
.displayName(userName ?? '')
.authToken(authToken)
.submit();
}
Need help on how to refresh the access token in flutter sdk? As mentioned in documention the validity of access token is 30 days if secured mode is enabled.