Ошибка invalid_request Invalid redirect_uri
Я создал 3 отдельных микросервиса: проект ProductAPI, проект Web(MVC) и приложение Identity. Я использую Duende Identity. В строке RedirectUris = {"https://localhost:44324/signin-oidc"} я перенаправляю ее на проект Web. Launchsettings.json перепроверял и applicationUrl с sslPort вставлял, как в RedirectUris. Что я сделал не так, что мне выдает такую ошибку??
Надеюсь, информации ниже хватит, на всякий случай Git - https://github.com/Alex-SHZ/FastFoodShop
Web.Program.cs
builder.Services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
}).AddCookie("Cookies", c => c.ExpireTimeSpan = TimeSpan.FromMinutes(10))
.AddOpenIdConnect("oidc", options =>
{
options.Authority = builder.Configuration["ServiceURLs:IdentityAPI"];
options.GetClaimsFromUserInfoEndpoint = true;
options.ClientId = "fastfood";
options.ClientSecret = "secret";
options.ResponseType = "code";
options.TokenValidationParameters.NameClaimType = "name";
options.TokenValidationParameters.RoleClaimType = "role";
options.Scope.Add("fastfood");
options.SaveTokens = true;
});
Web.launchSettings.json
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:14476",
"sslPort": 44324
}
},
"profiles": {
"FastFood.Web": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "http://localhost:53638",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Identity.Redirect_uri
public static IEnumerable<Client> Clients =>
new List<Client>
{
new Client
{
ClientId="client",
ClientSecrets = { new Secret("secret".Sha256()) },
AllowedGrantTypes = GrantTypes.ClientCredentials,
AllowedScopes = { "read", "write", "profile" }
},
new Client
{
ClientId="fastfood",
ClientSecrets = { new Secret("secret".Sha256()) },
AllowedGrantTypes = GrantTypes.Code,
RedirectUris = {"https://localhost:44324/signin-oidc"},
PostLogoutRedirectUris = { "https://localhost:44324/signout-callback-oidc"},
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
"fastfood"
}
},
};
Identity.ApiScopes
public static IEnumerable<ApiScope> ApiScopes =>
new List<ApiScope>
{ new ApiScope("fastfood", "FastFood Server"),
new ApiScope(name: "read", displayName: "Read your data."),
new ApiScope(name: "write", displayName: "Write your data."),
new ApiScope(name: "delete", displayName: "Delete your data."),
};
Спасибо
