Community Member
 · AeroQuote.com

Map additional claims properties to user using JWT authentication

I have successfully setup JWT token authentication in Firebase by following the JWT auth documentation.

I want to display the Auth user properties "display_name" and "email" that were provided when the JWT token was created.

I have confirmed the claims properties exist in Firebase Auth...

Lcobucci\JWT\Token\DataSet {#2096
    -data: [
      "display_name" => "Demo Account",
      "email" => "[email protected]",
      "phone_number" => null,
      "iss" => "https://securetoken.google.com/aeroquote-e01b4",
      "aud" => [
        "aeroquote-e01b4",
      ],
      "auth_time" => 1694141848,
      "user_id" => "9a12ebf6-28f0-4f50-a1d1-dd5146096f44",
      "sub" => "9a12ebf6-28f0-4f50-a1d1-dd5146096f44",
      "iat" => DateTimeImmutable @1694141848 {#2094
        date: 2023-09-08 02:57:28.0 +00:00,
      },
      "exp" => DateTimeImmutable @1694145448 {#2088
        date: 2023-09-08 03:57:28.0 +00:00,
      },
      "firebase" => [
        "identities" => [],
        "sign_in_provider" => "custom",
      ],
    ]
  }

However, there is no process to map the claims into the User fields at the time of JWT auth.

A work-around is to run an action that updates the user fields via an API call to my auth server and an endpoint that returns the necessary details...

Can I access the claims on the Firebase Auth user account in flutterflow ?

Thanks!

Tom.

7
2 replies