The cause may be RedirectUris
of a client do not include the actual redirect uri the client app is sending. This is configured in Client.cs
method GetClients
:
new Client
{
...
RedirectUris = new[] { "https://..." },
PostLogoutRedirectUris = new[] { "https://..." },
AllowedCorsOrigins = new[] { "https://..." },
}
The redirect URI must match exactly the address the client is sending, including the HTTP scheme (http, https).
This can be found in log the file that lists allowed URIs and the actual URI of a failed authorization request. Identity server is using serilog, in program.cs
it can be switched on in Main
method:
...
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("System", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.File("logs\\the-log-file-name.txt")
.CreateLogger();
BuildWebHost(args).Run();