0

I have implemented the IPesistedGrantStore in IdentityServer4 and am storing access tokens in a database. The Get method retrieves these access tokens correctly. The problem is with refresh tokens. How are they stored? For the access token I store the PersistedGrant object, which is: Key, Type, SubjectId, ClientId, CreationTime, Expiration, and Data. But the refresh token is not being stored. I know there is a refresh_token because that value is returned from a password token request in Postman, along with access_token, expires_in, and token_type.

So when I try and request a refresh token I get the following:

2019-03-19 13:28:19,326 [4] DEBUG PersistedGrantStore -> Grant retrieved: /jjI7S51px7ApIt+zVxiNDOUe5Y16kYfNTSp2f37WnU= 
2019-03-19 13:28:19,328 [4] DEBUG DefaultRefreshTokenStore -> refresh_token grant with value: 4cadcc4c0d5b7e77e78e353a773c838d7f66e48507ea5303f9349c86555ed896 not found in store. 
2019-03-19 13:28:19,330 [4] ERROR TokenValidator -> Invalid refresh token 

It's fetching the access token and states it's an invalid refresh token. So I'm totally confused.

Bob W
  • 65
  • 1
  • 6
  • I have figured this out. I was setting the persisted grant type to access_token instead of refresh_token. – Bob W Mar 19 '19 at 20:02
  • where do you set that? – koo9 Feb 26 '20 at 22:22
  • IdentityServer4.Models.PersistedGrant.Type = "refresh_token" – Bob W Feb 28 '20 at 14:43
  • need to add offline_access to scope when requesting the token. then ids4 will add an entry to the persisted grant table. when validating the refresh token, it will be in that table. otherwise it won't find the refresh token and the validation will failed. – koo9 Feb 28 '20 at 19:24

0 Answers0