c# - ASP.NET Core API authentication using Firebase and Identity -
i have api use firebase jwt token authentication.
in startup.cs
registered identity
:
services.addidentity<applicationuser, identityrole>(config => { config.user.requireuniqueemail = true; config.password.requirenonalphanumeric = false; config.cookies.applicationcookie.automaticchallenge = false; }) .addentityframeworkstores<databasecontext>() .adddefaulttokenproviders();
and added jwt token middleware:
app.usejwtbearerauthentication(new jwtbeareroptions { automaticauthenticate = true, includeerrordetails = true, authority = "https://securetoken.google.com/[my-project-id]", tokenvalidationparameters = new tokenvalidationparameters { validateissuer = true, validissuer = "https://securetoken.google.com/[my-project-id]", validateaudience = true, validaudience = "[my-project-id]", validatelifetime = true, }, });
i'm protecting routes [authorize]
, it's working fine. httpcontext.user.identity.authenticated
property set true
, else on user
object null, name, e-mail, etc.
is there way link user generated token middleware users in database? what's best approach access information controllers?
Comments
Post a Comment