By using AWS re:Post, you agree to the Terms of Use

How to login into the AWS SSO using AWS CLI without needing browser?


Hello, I want to login into the AWS SSO using AWS CLI, but i want to use only CMD , without interacting with browser , is there any solutions for this?

  • Do you want to connect to any AWS account using the SSO parameters?

2 Answers
Accepted Answer

The answer here is 'no'. As part of the AuthN process when you're working with AWS SSO programmatically, a browser must be used so that you can authorise the CLI client.

What you can do here is the following:

  • Use a preferred browser.
  • Skip a webpage by going to the 'verificationUriComplete' instead of 'verificationUri' (These are output fields from the 'StartDeviceAuthorization' call of the 'SSO-OIDC' API suite). The former being the verification URI, with the OTP 'userCode' included.

What you can do is create a script of your own which automates everything up until the point where you simply have to click on 'Authorize' on the web browser page that opens before you, due to the script. That's what I ended up doing through PowerShell and the AWS Tools for PowerShell.

profile picture
answered 9 months ago
  • Okay, thank you for your time and answer, from the answer and some googling i understood that i can only "authenticate" in AWS SSO using AWS CLI trough HTTPS requests/answers (because this is how AWS api works?)? If im right, then everything could be "scripted", but anyway, can you share your powershell scripts (and maybe in any other language) regarding this "automation" ?


You can use AWS CLI with AWS SSO. Please refer to AWS Doc below

If you want to see a demo, you can refer to below link.


answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions