IdentityServer 4: No storage mechanism for grants specified - use AddInMemoryStores

血红的双手。 提交于 2020-05-09 07:39:12

问题


I am using Identity Server 4 , ASP.NET Core and trying to replace the IdentityServer developer in Production environment. But getting the following error:

No storage mechanism for grants specified. Use the 'AddInMemoryStores' extension method to register a development version.

So, I tried to implement the services as mentioned in this answer:

  • IProfileService
  • IResourceOwnerPasswordValidator

This is my ConfigureServices Method in Startup class:

            services.AddMvc();
            var identityBuilder = services.AddIdentityServer();
            identityBuilder.AddInMemoryScopes(identitySrvConfig.GetScopes());
            identityBuilder.AddInMemoryClients(identitySrvConfig.GetClients());
            identityBuilder.AddProfileService<ProfileService>();
            identityBuilder.Services.AddTransient<IResourceOwnerPasswordValidator, ResourceOwnerPasswordValidator>();

Taking into consideration that in my case the interface signature is different:

 public class ResourceOwnerPasswordValidator : IdentityServer4.Validation.IResourceOwnerPasswordValidator
{
    public Task ValidateAsync(ResourceOwnerPasswordValidationContext context)
    {
        throw new NotImplementedException();
    }
}

But I am still getting the same error, what is the problem?


回答1:


They were/are reworking those APIs. You should use AddInMemoryPersistedGrants




回答2:


Asp.net Core and IdentityServer4 quick start doesn't work #1359

https://github.com/IdentityServer/IdentityServer4/issues/1359



来源:https://stackoverflow.com/questions/40797993/identityserver-4-no-storage-mechanism-for-grants-specified-use-addinmemorysto

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!