On running the below line in powershell script getting error

PS C:\Devlopment\eKeystoneHelix\KAO> dotnet sitecore login --authority https://maj-testhelix.identityserver/ --cm http://maj-testhelix/ --allow-write true

Error: Logging in to Sitecore. You should see a browser window open shortly.

ClientId Device is invalid for device authorization.


4 Answers 4


you need to login into PowerShell as Admin.

enter image description here

Hope this helps!

Thanks, Yamini


By default Sitecore Client ID is Device only

Either run PowerShell as admin and Make sure Client ID parameter is there in USER.Json


This blog post provides the solution:

Sometime after running non-interactive CLI command, you may get error like this “ClientId ‘xxxSitecoreCLIServer’ is invalid for device authorization.”. To fix it, you need to delete user file “user.json” in folder “.sitecore\”, then run following command instead.

dotnet sitecore login --authority https://si-url --cm https://cm-url --allow-write true --client-credentials false


Please go to your solution folder and go check if you have .sitecore directory and ensure that you have user.json file in there, which contains the token, If you don't have it then try to re-create, Assuming you're are using an Admin user or some other account to log into CM node.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.