I\'m new at IdentityServer4. I read I need to implement an IPersistedGrantStore
to store refresh tokens into a table like PersistedGrants
in my dat
The key will be to implement IPersistedGrantStore
using whatever backend you like, then to tell IdentityServer to use that implementation by registering the implementation in the dependency injection system.
For example, if you call your implementation PersistedGrantStore
, then you could register the implementation like this:
services.AddTransient<IPersistedGrantStore, PersistedGrantStore>();
You can see that essentially this is all that the EntityFramework implementation does, once you take away all the EntityFramework stuff.
Later when IdentityServer wants to persist a grant, it will get your implementation and call the appropriate method. So you don't have to do anything, other than inject your implementation into IdentityServer so it can do whats needed.
I know the question is kind of old and you might have already found the problem. I think your only mistake is that you invented your own interface instead of implementing:
IdentityServer4.Stores.IPersistedGrantStore
If you want to use your own CustomPersistedGrant it should derive from:
IdentityServer4.Models.PersistedGrant
otherwise you would have to wrap it somehow.