0

I've added IdentityServer4 NuGet package to ASP.NET core project using dotnet cli. Then written the following code on Startup class.

public void ConfigureServices(IServiceCollection services)
    {           
        services.AddIdentityServer()
            .AddInMemoryClients(new Client[] 
                { 
                    new Client
                    { 
                        ClientId = "react client", 
                        ClientName = "React Client",
                        AllowedGrantTypes = GrantTypes.Implicit,
                        RedirectUrls = {"http://localhost:51009/"},
                        AllowedScopes = { "openid"}
                    }
                });            
        services.AddMvc();
    }

Then when I build the project it shows error: The type or namespace name 'Client' could not be found (are you missing a using directive or an assembly reference?)

Moreover VS Code doesn't show any suggestion for IdentityServer related code.

And when I search IdentityServer4 on NuGet website it shows result like following: Search result on NuGet website




And when I search IdentityServer4 on Visual Studio 2017 it shows result like following: Search result on Visual Studio 2017

Towhid
  • 1,920
  • 3
  • 36
  • 57

2 Answers2

0

The IdentityServer4 Client class is located in the IdentityServer4.Models namespace which is included in the nuget-package.

Adding the using-statement where the model/models are needed should resolve the issue

using IdentityServer4.Models
Marcus Höglund
  • 16,172
  • 11
  • 47
  • 69
0

VS Code was not showing intellisense because of an OmniSharp bug. Solution to this problem is restarting OmniSharp.

Ctrl + Shift + P and then type Restart OmniSharp

Towhid
  • 1,920
  • 3
  • 36
  • 57