How to request a refresh token with identityserver4

Viewed 1624

I have IdentityServer and a separate WebApi project using resource owner flow.

When I request a token as below the token is issued and can be used to access the WebApi. So I assume IdentityServer is setup correctly, and the WebApi project is setup correctly as well.

username=user1
password=user1password
grant_type=password
client_id=myClientId
client_secret=myClientSecret
scope=api1

Now when I change the grant type to refresh and the scope to offline_access I get a refresh token. I then use the refresh token to get an access token, but when I use the access token to request the WebApi it is rejected.

With an error

the audience is invalid

I suspect it's because I am asking for an offline_access scope instead of api1 scope which the WebApi project expects. How do I get a refresh token that can use used with the scope api1?

1 Answers
Related