Getting the Logged-in User

When the user authenticates successfully, Cotter's SDK will automatically store the logged-in user in the device's secure storage.

To get the user information, call cotter.getUser() :

Cotter cotter = new Cotter(apiKeyID: API_KEY_ID);
void getLoggedInUser() async {
  try {
    var user = await cotter.getUser();
  } catch (e) {

This function returns the User object.

If the user's id_token is expired, this function will automatically attempt to refresh the token, resulting in refreshing the user's session, and return the User object if successful. Otherwise, this function will throw an error if the session is expired.

Please use the identifier (email/phone number) as your main way to identify users, Cotter's User ID is deprecated.

Last updated