Refresh Access token in Flutter

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.

Hi @AmanGrappus ,

Can you please help clarify what is the issue you’re facing exactly.

Do you need the flutter sample code to refresh access token, or if there’s an error can you please help share details? Is this code shared what you’re currently using?

Thank you,
Amity Support

I can see amity provide mechanism to auto refresh accesstoken in Android, IOS sdk but not the case with flutter sdk. I am using above shared code to get access token and generate session for the user.
Need help with the implementation of refresh token in flutter sdk.

Hi @AmanGrappus ,

Unfortunately we don’t have sample code for flutter SDK right now. With every new login the token will automatically be renewed.

Thank you,
Amity Support