You are trying to log in through an instance URL (example: sandbox) and you do this.
sfdx auth:web:login -a myusername@myorg.sandbox --instanceurl=https://mysandbox-domain.lightning.force.com
And you get this error in console:
ERROR running auth:web:login: Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: grant type not supported
In your browser you get this
Error authenticating with auth code due to: grant type not supported.
This is most likely not an error with the Salesforce CLI. Please ensure all information is accurate and try again.
This is most likely not an error with the Salesforce CLI. Please ensure all information is accurate and try again.
The problem is you are using lightning.force.com domain instead of my.salesforce.com
sfdx auth:web:login -a myusername@myorg.sandbox --instanceurl=https://mysandbox-domain.my.salesforce.com