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

0

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?

1 Answer
4
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 pictureAWS
answered 2 years 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" ?

  • What is the way then to access Amazon services, like the one I need - TTS Polly? Do I always need a browser? I just try to follow the docs (unsuccessfully) and at this browser step which even doesn't work. But thinking about the future usage of my tool, dependence on a browser would just render it useless. I'm totally confused really.

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