I'm trying to create an asp.net core api that verifies the user Identity using firebase authentication, and store all his data in internal postgreSQL data base - including rules for authorization (such as Admin and other custom rules).
I Managed to verify the token using the firebase nuget package:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDBContext>(options => options.UseNpgsql(
Configuration.GetConnectionString("DeafultConnectionString")));
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddFirebaseAuthentication(Configuration.GetSection("FirebaseAuth:issuer").Value,
Configuration.GetSection("FirebaseAuth:audience").Value);
// services.AddIdentity<Auth.ApplicationUser, IdentityRole>().AddEntityFrameworkStores<ApplicationDBContext>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseHsts();
}
app.UseAuthentication();
app.UseHttpsRedirection();
app.UseMvc();
}
}
and this works perfectly fine! I'm trying to understand how I connect my database to store the user details - but I can't uderstand how it's done. any help?