IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

Discovery document generation bug

Open Ice2burn opened this issue 9 years ago • 3 comments

Issue / Steps to reproduce the problem

  1. Populate ApiResource List
public static IEnumerable<ApiResource> GetApiResources()
        {
            return new List<ApiResource> {
                new ApiResource("api1", "My API #1"),
                new ApiResource("api2", "My API #2"),
                new ApiResource("logsapi", "My API #3"),
                new ApiResource("logsApi1", "My API #4"),
                new ApiResource("logs_api", "My API #5"),
                new ApiResource
                {
                    Name = "logsapi2",
                    DisplayName = "My API #6"
                },
                new ApiResource
                {
                    Name = "LogsPapi3",
                    DisplayName = "My API #6",
                    Description = "My API #6 or #7"
                }
            };
        }
  1. Update database. So ApiResources table looks according to ApiResource List: Id DisplayName Enabled Name 1 My API #1 1 api1 2 My API #2 1 api2 3 My API #3 1 logsapi 4 My API #4 1 logsApi1 5 My API #5 1 logs_api 6 My API #6 1 logsapi2 7 My API #6 1 LogsPapi3

  2. Discovery document has only first 5 declared api, 2 missing (logsapi2 and LogsPapi3):

"scopes_supported": [
"api1",
"api2",
"logsapi",
"logsApi1",
"logs_api",
"offline_access"
],

All Nuget packages are up to date. ConfigurationDbContext populated correctly.

Ice2burn avatar Apr 25 '17 17:04 Ice2burn

You need to define at least one scope for each API resource -

the ctor with api name does that automatically for you, if you use the property approach you need to do that manually.

leastprivilege avatar Apr 26 '17 12:04 leastprivilege

That fixed it, thank you

Ice2burn avatar Apr 26 '17 12:04 Ice2burn

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 14 '20 18:01 lock[bot]