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 個回答
4
已接受的答案

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
已回答 2 年前
  • 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.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南