Flutter: Amity sdk asks for login every time user reopens the app

Hi Amity,
When ever I re open the Flutter app I check if user is logged in using this:

AmityCoreClient.isUserLoggedIn();

This always return false.

I am using below code to login user:

AmityCoreClient.login(userIntegerId)
.displayName(name)
.authToken(“#auth_token”)
.submit()

Is it expected behaviour ? Should user login again when ever he/she is opening the app?
Kindly look into this.

@maddy0028 ,

Did you enable secure mode? If not then adding random auth token will result in an error. Also, did the login successfully return success before checking login status with AmityCoreClient.isUserLoggedIn() ?

Thank you,
Amity Support

Hi @amitysupport
Thank you for your response. I am getting user detail on login success. Then I am restarting the app, at that time I am using AmityCoreClient.isUserLoggedIn() to check login status for user. This returns false for logged in user.

Please help me in this.
Thanks

Noted we’re confirming for you

@amitysupport I am facing same issue, do we have to login on each app open session?
I tried fetching user details and the error says App dont have active user, Please login. after successfully login in pervious app session.

@maddy0028 when you refer to ‘restarting’ means you killed the app and reopen it again, is that correct? or leaving the app in the background mode?

Yes @amitysupport I killed the app and restarted it again.

Hello, got confirmed from our team that this is expected behaviour. Users will have to log in again if the app is killed.