Wednesday, June 1, 2022

AWS CLI SSO Login - "Could not connect to the endpoint URL" Error

When attempting to log in via AWS SSO on the command line, you may encounter an error like below:

> aws sso login --profile <profile-name-from-aws-config>

Could not connect to the endpoint URL: "https://oidc.<region>.amazonaws.com/device_authorization"

I had not changed any settings.  It just randomly stopped working.

While I'm not sure of the root cause, restarting the PC has fixed it for me more than once. I have also thought that renaming your ~/.aws/sso folder might do the trick.

AWS CLI v2.2.43