Search code examples
single-sign-oncloud-foundrypaasswisscomdev

Swisscom Passeport two-step login with Cloud Foundry CLI


How can I login with the Cloud Foundry CLI to the Swisscom Application Cloud when I have activated the two-step login method (password and SMS code) in my Swisscom Passeport account?

$ cf login -a https://….appcloud.swisscom.com -u …
API endpoint: https://….appcloud.swisscom.com

Password> 
Authenticating...
Credentials were rejected, please try again.

After entering my Passeport password on the command line I do receive the SMS code, however there's no possibility to enter it on the command line.


Solution

  • If you enable Passeport's two-factor authentication, you have to use the --sso flag and follow the instructions:

    cf login -a https://api.lyra-836.appcloud.swisscom.com --sso
    API endpoint: https://api.lyra-836.appcloud.swisscom.com
    
    One Time Code ( Get one at https://login.lyra-836.appcloud.swisscom.com/passcode )>
    

    Switching to the browser and obtaining an OTP is needed because the cf cli does not support two-step auth directly on the cli yet.

    We will add this info to the official documentation.