# Problem with flutter and auth0 api

**URL:** <https://community.auth0.com/t/problem-with-flutter-and-auth0-api/87747>\
**Category:** Get Help\
**Created:** [July 27, 2022, 1:19pm UTC](https://community.auth0.com/t/problem-with-flutter-and-auth0-api/87747 "2022-07-27T13:19:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arenasduranj](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/arenasduranj/32/33632_2.png) [@arenasduranj](https://community.auth0.com/u/arenasduranj)\
**Post date:** [July 27, 2022, 1:19pm UTC](https://community.auth0.com/t/problem-with-flutter-and-auth0-api/87747/1 "2022-07-27T13:19:06Z")

</div>

Hello my friends. I’m perfom a login with flutter and auth0: this is the code:

```auto
Future<void> login(Map<String, dynamic> authData) async {

    try {
      final credentials = await auth0.api.login(
        usernameOrEmail: authData["email"],
        password: authData["password"],
        connectionOrRealm: "Username-Password-Authentication"
      );

      await auth0.credentialsManager.storeCredentials(credentials);

      isLoggedIn = await auth0.credentialsManager.hasValidCredentials();
      notifyListeners();

    } on ApiException catch(e) {
      print(e);
      isLoggedIn = false;
      notifyListeners();
    }
  }

```

I have enabled the grant type in this case (Password) and the console show me this:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/4/e/4e36a2cbfba7a65373cc40bc771729281cf1ed18.png)

What is exactly? Maybe i have forgotten some config?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [July 28, 2022, 1:04am UTC](https://community.auth0.com/t/problem-with-flutter-and-auth0-api/87747/3 "2022-07-28T01:04:36Z")

</div>

Hey there @arenasduranj welcome to the community!

Interesting! I did some digging on my end and did come across the `validateClaims()` method which is indeed required:

> <https://github.com/auth0/Auth0.Android/blob/8a032a8451bba5b69e68ac2ff77d1f5560d09f05/README.md#login-with-database-connection>

Shameless plug for our new Flutter SDK (first availability) 😄

> [@Auth0-flutter SDK First Availability!](https://community.auth0.com/t/auth0-flutter-sdk-first-availability/87739):
>
> auth0-flutter SDK: First Availability! We are pleased to announce the [first availability](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages#first-availability) release of our auth0-flutter, our brand new SDK for adding authentication to Flutter applications. With auth0-flutter, you now have native Auth0 support for key Authentication API operations like login with username and password , signup, get user info, renew user credentials and reset password. Included in this release we also extend support for web auth login/logout, automatic storage and renewal of user…

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [August 12, 2022, 1:04am UTC](https://community.auth0.com/t/problem-with-flutter-and-auth0-api/87747/4 "2022-08-12T01:04:53Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
