iits-consulting / otc-auth

Open Source CLI for the Open Telekom Cloud written in go.
GNU General Public License v3.0
44 stars 4 forks source link

Error login: Exactly one of Username and UserID must be provided #78

Closed ManuelLeiner closed 10 months ago

ManuelLeiner commented 10 months ago

Setup

Actual Behavior

Since 2.0.0 (that is why I didn't upgrade back then) I cannot login via Service Provider Login (IAM)

otc-auth login iam --os-username <username> --os-password <password> --os-domain-name <domain_name> --os-user-domain-id <user_domain_id> --totp <6_digit_token> --region <region>

As soon as I provide --totp for MFA I have to provide all of the parameters above. All variables are properly exported / env variables.

otc-auth login iam --overwrite-token --totp xxxxxx                                                                                                                                                                                                                                                 
2024/01/02 17:35:02 info: cloud OTC-xx-yy-zzzzzzzzzzzzzzzz loaded successfully and set to active.
2024/01/02 17:35:02 info: retrieving unscoped token for active cloud...
2024/01/02 17:35:02 error extracting token: Exactly one of Username and UserID must be provided for password authentication

As soon as I unset one of Username or UserID, I get the following messages:

otc-auth login iam --overwrite-token --totp xxxxxx                                                                                                                                                                                                                                                   
Error: required flag(s) "os-username" not set

or:

otc-auth login iam --overwrite-token --totp xxxxxx                                                                                                                                                                                                                                                   
Error: if any flags in the group [totp os-user-domain-id] are set they must all be set; missing [os-user-domain-id]

Expected Behavior

Using the latest version I can login via otc-auth login iam --totp.

ManuelLeiner commented 10 months ago
victorgetz commented 10 months ago

Seems like a bug to me @Ninja243

Ninja243 commented 10 months ago

Yep, I'm looking into this, thanks!

Ninja243 commented 10 months ago

@ManuelLeiner this should be fixed with version 2.0.10 which should also be available on brew now. If it still doesn't work or I missed something, feel free to re-open this Issue!

ManuelLeiner commented 10 months ago

I finally could test it out and it works but you might have to update the README.md

The following command (from readme) leads to the error message below

  otc-auth login iam \
    --os-username ${username} \
    --os-password "${password}" \
    --os-domain-name ${domain} \
    --os-user-domain-id ${userid} \
    --totp ${totp} \
    --region ${project} \
    --overwrite-token

2024/01/26 12:39:42 when using MFA (totp), the userID should be given, not the username

The actual command that is working is:

  otc-auth login iam \
    --os-password "${password}" \
    --os-domain-name ${domain} \
    --os-user-domain-id ${userid} \
    --totp ${totp} \
    --region ${project} \
    --overwrite-token
Ninja243 commented 10 months ago

Thanks, I missed that! The Readme has been updated 👍