使用 Cloud Foundry CLI 的 Swisscom Passeport 两步登录

Swisscom Passeport two-step login with Cloud Foundry CLI

当我在 Swisscom Passeport account 中激活了两步登录方法(密码和短信代码)后,如何使用 Cloud Foundry CLI 登录到 Swisscom Application Cloud?

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

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

在命令行中输入我的 Passeport 密码后,我确实收到了短信代码,但是无法在命令行中输入它。

如果启用 Passeport 的双因素身份验证,则必须使用 --sso 标志并按照说明操作:

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 )>

需要切换到浏览器并获取 OTP,因为 cf cli 尚不支持直接在 cli 上进行两步验证。

我们会将此信息添加到官方文档中。

因为很多用户在登录 iAPC(内部应用云)时遇到问题,所以我 post 在此提供步骤。 对于外部用户,此 API 端点不可访问,您需要在 Corproot 网络中(配置代理)。

unset https_proxy http_proxy HTTP_PROXY HTTPS_PROXY
cf login -a https://api.scapp-console.swisscom.com --sso
API endpoint: https://api.scapp-console.swisscom.com

One Time Code ( Get one at https://login.scapp-console.swisscom.com/passcode )> 
Authenticating...
OK

Select an org (or press enter to skip):
(...)

Select a space (or press enter to skip):
(...)

Space> test
Targeted space Test



API endpoint:   https://api.scapp-console.swisscom.com (API version: 2.92.0)
User:           xxx.xxx@swisscom.com
Org:            xxx
Space:          xxx

一次性代码的截图(您需要复制并粘贴到 CF CLI)

此 CF 安装已连接到 Corproot 域。您需要使用您的 Corproot 凭据(与您在桌面上使用的凭据相同)。

如果你做错了,这个如何错误(Credentials were rejected, please try again)看起来:

cf push
FAILED
Not logged in. Use 'cf login' to log in.

cf login
API endpoint: https://api.scapp-console.swisscom.com
Email> xxx.xxx@swisscom.com
Password>
Authenticating...
Credentials were rejected, please try again