rajesh
rajesh

Reputation: 1485

Refresh Token and Access Token from Identity Server4

I tried to get the both access and refresh token by using below method but it returns invalid_scope and bad request. If I remove the offline_scope value for the scope it returns access token only.

 var tokenResponse = await protocolClient.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
                    {
                        Address = disco.TokenEndpoint,
                        ClientId = ServiceIdentity,
                        ClientSecret = ServiceKey,
                        Scope = "offline_access",
                        GrantType = "GrantTypes.ClientCredentials"
                    });
                    return tokenResponse.AccessToken;

Upvotes: 0

Views: 416

Answers (1)

d_f
d_f

Reputation: 4869

That's by design. GrantTypes.ClientCredentials does not support refresh token. The reason is that you can get a fresh access token anytime, using the same client id and secret.

Upvotes: 1

Related Questions