In my asp net core 5 (api) i have integrated firebase authentication with this middleware:
public void ConfigureServices(IServiceCollection services)
{
services
.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.Authority = "https://securetoken.google.com/my-project-id";
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidIssuer = "https://securetoken.google.com/my-project-id",
ValidateAudience = true,
ValidAudience = "my-project-id",
ValidateLifetime = true
};
});
services.AddControllers();
}
I have follow this tutorial: https://blog.markvincze.com/secure-an-asp-net-core-api-with-firebase/
It works: adding [Authorize] to the controller, i need to pass the bearer token. Now, in the controller action, i need to get the current user id and email that is authenticated.
How can i get the user id and user email from firebase (the user that is authenticated through firebase)?