How to resolve Invalid_grant error in Sitecore CLI
One on my forks encountered this error while using Sitecore CLI and its very common for Sitecore CLI users and that is invalid_grant error.
To resolve this error we need to put latest values of access token and refresh token in USER.json
so we have two ways to do this.
1. use this command and allow this on browser.
dotnet sitecore login --authority https://<sitecore-identity-server> --cm https://<sitecore-instance> --allow-write true
this we put latest values of access token and refresh token in user.json
2.By using postman post call we can get access token and refresh token values and put it in our user.json
Download postman and hit your identity server url with /connect/token
in body send additional key values as sent in the above picture.
For first time users it will throw SSL certificate error for this just disable SSL verification
and hit post call again it will give you access token and refresh token. put the below values in body
x-www-form-urlencoded
key - value
grant_type - password
client_id - SitecorePassword
username - sitecore\admin
password - b
client_secret - IdentityServerClientSecret
or you can directly import the below collection and change your identity server url.
Comments
Post a Comment