simpleidserver / SimpleIdServer

OpenID, OAuth 2.0, SCIM2.0, UMA2.0, FAPI, CIBA & OPENBANKING Framework for ASP.NET Core
https://simpleidserver.com/
Apache License 2.0
682 stars 90 forks source link

redirect_uri error. #761

Open simphonydeveloper opened 2 weeks ago

simphonydeveloper commented 2 weeks ago

https://simpleidserver.com/docs/tutorial/regularweb

I authorized according to the document, but this error occurred.

https://localhost:7233/claims
{
  "error": "invalid_request",
  "error_description": "redirect_uri https://localhost:7233/signin-oidc is not correct",
  "state": "CfDJ8PZ8k5OQmJdKogCa1orNaUtleQKpAfsPpAHFSe6QQH6gfvnxfv1JTQSFGzEomnNVweodILbnGW7C3BeSgm3iO0pBc3VeSStctxA26ivMUAl25IQV1-pK-fuh4TT896Bsoe-tFOuhDFa2Q8IqOmubOAt31NILji8rocXDFM7sonBvteN0eWswfiNr7KTBYfekztQnHTBtEL4Ysj4P3iIaPNVlwDmfXd_3oRLQ9GQvt355UcDtS852jQUeQCZx0z8THlKVofAqphrVfCRccF5PeoPQ4GnrSXThFj1QcQy88-s7g_J5Ic432FeOU4fWepYs1Y6TkuxqpeEygF5gWDpFCXykSk-6JJtJQKkPQIbANdkT8kvunwKUvj5sxeNtd1KCRw"
}

my application configuration.

 public static void Main(string[] args)
 {
     var builder = WebApplication.CreateBuilder(args);

     // Add services to the container.

     builder.Services.AddControllers();
     // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
     builder.Services.AddEndpointsApiExplorer();
    // builder.Services.AddSwaggerGen();

     builder.Services.AddAuthentication(options =>
     {
         options.DefaultScheme = "Cookies";
         options.DefaultChallengeScheme = "sid";
     })
     .AddCookie("Cookies")
     .AddOpenIdConnect("sid", options =>
     {
         options.SignInScheme = "Cookies";
         options.ResponseType = "code";
         options.Authority = "https://localhost:5001/master";
         options.RequireHttpsMetadata = false;
         options.ClientId = "protectedServersideApp";
         options.ClientSecret = "password";
         options.GetClaimsFromUserInfoEndpoint = true;
         options.SaveTokens = true;
     });

     var app = builder.Build();

     // Configure the HTTP request pipeline.
     if (app.Environment.IsDevelopment())
     {
         //app.UseSwagger();
         //app.UseSwaggerUI();
     }
     app.UseCookiePolicy(new CookiePolicyOptions
     {
         Secure = CookieSecurePolicy.Always
     });
     app.UseHttpsRedirection();
     app.UseStaticFiles();

     app.UseRouting();
     app.UseAuthentication();
     app.UseAuthorization();
     app.MapControllerRoute(
         name: "default",
         pattern: "{controller=Home}/{action=Index}/{id?}");

     app.Run();
 }

client details. image

simphonydeveloper commented 2 weeks ago

when i add callbackpath it working.

            .AddOpenIdConnect("sid", options =>
            {
                options.SignInScheme = "Cookies";
                options.ResponseType = "code";
                options.Authority = "https://localhost:5001/master";
                options.RequireHttpsMetadata = false;
                options.ClientId = "protectedServersideApp";
                options.ClientSecret = "password";
                options.GetClaimsFromUserInfoEndpoint = true;
                options.SaveTokens = true;
                options.CallbackPath = "/home";
            });