benkehoe / aws-sso-util

Smooth out the rough edges of AWS SSO (temporarily, until AWS makes it better).
Apache License 2.0
932 stars 70 forks source link

Prepopulate the Authorization Code in the SSO URL #91

Closed shaundewberry closed 1 year ago

shaundewberry commented 1 year ago

Allows to skip the copy-paste step and prepopulates the authorization code in the browser login.

benkehoe commented 1 year ago

If I understand correctly, the change you're looking to make is to browser.py. I want to keep that message mostly in sync with the AWS CLI's aws sso login command, which is implemented here. I notice that they have added the verificationUriComplete URL to the message (well, only when you're using --no-browser), which is what you're looking for (there's no guarantee that the format for putting the code in the plain URL remains stable, that's why there's a separate parameter returned by the API for it). Note they have newline characters in their strings but here we use multi-line strings.

So, with that in mind, here's how I'd like to do it:

Does that make sense? I would also ask that you update the PR to be just a single clean commit to be added to the next branch.

shaundewberry commented 1 year ago

Thank you for the excellent guidance. I am implementing as per your suggestion and testing now.