I was given with an URL to use as an Identity provider (using Open connect id protocol), I only have to be able to login using this provider.
The issue I am having is when I try to login, I get this URL in the browser, and after a second it redirects again to my localhost, not been able to login:
That is what I did when creating a web application:
In the project template:
- .Net Core: Asp.net Core 2.2
- Template: web application (model-view-controller)
Change Authentication: I selected individual user account and then Connect to an existing user store in the cloud. After filling all the boxes come out this configuration in the appsettings.json:
{ "AzureAdB2C": { "Instance": "https://sitekitdev.b2clogin.com/tfp/", "ClientId": "6e093bdb-ba93-4c02-83fb-77678f07b14b", "CallbackPath": "/signin-oidc", "Domain": "sitekitdev.onmicrosoft.com", "SignUpSignInPolicyId": "B2C_1_Signuporin", "ResetPasswordPolicyId": "All", "EditProfilePolicyId": "" }, "Logging": { "LogLevel": { "Default": "Warning" } }, "AllowedHosts": "*" }
Then I didn't change nothing alse, so it all the default web page.
The Identity provider endpoint I have to use:
Note: the first url, I got in the browser is a bit different than this, in the first one I don't have the first part login.microsoftonline.com
And this is my startup class:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddAuthentication(AzureADB2CDefaults.AuthenticationScheme)
.AddAzureADB2C(options => Configuration.Bind("AzureAdB2C", options));
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}
// 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.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseAuthentication();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
I just need to be able to login, and then get the JWT back (I will working configuring this after I am able to see the login page).
Thanks