Pivotal Cloud Foundry login issue

2019-07-16 19:14发布

问题:

I have a PWS account and after installing Cloud Foundry command line interface (CLI), I tried login from windows command prompt, CYGWIN terminal and Gitbash. In all the above cases, I cannot login by cf login

But I am able to login if i issue the command: cf auth email password But the problem with this command is that I am exposing my password on the command line.

Question: I would like to know how users of Cloud Foundry Command Line Interface, login to the PWS.


Update 04/29: Sharing what i see while trying cf login in Cygwin and Gitbash. Both gives the same type of error response. Note that I don't want to put -p password as plaintext in command line unless I am asked explicitly.

mypc /d/spiderman
$ cf login -a https://api.run.pivotal.io
API endpoint: https://api.run.pivotal.io

Email> myemail@gmail.com
Authenticating...
Credentials were rejected, please try again.
Authenticating...
Credentials were rejected, please try again.
Authenticating...
Credentials were rejected, please try again.


API endpoint:   https://api.run.pivotal.io (API version: 2.80.0)
Not logged in. Use 'cf login' to log in.
FAILED
Unable to authenticate.

It's not even asking for password, and responding that unable to authenticate!

In windows command prompt:

D:\spiderman>cf login
API endpoint: https://api.run.pivotal.io

Email> myemail@gmail.com

Password>  [I gave correct password]
Authenticating...
Credentials were rejected, please try again

.

@Kumaresh Babu I tried what you suggested and still unable to authenticate [Tried in cygwin]

mypc /d/spiderman
$ cf login -a https://api.run.pivotal.io --skip-ssl-validation -o my-org -s development API endpoint: https://api.run.pivotal.io

Email> myemail@gmail.com
Authenticating...
Credentials were rejected, please try again.
Authenticating...
Credentials were rejected, please try again.
Authenticating...
Credentials were rejected, please try again.

API endpoint:   https://api.run.pivotal.io (API version: 2.80.0)
Not logged in. Use 'cf login' to log in.
FAILED
Unable to authenticate.

@Kumaresh Babu

I tried the same command in windows command prompt and it worked, I am able to login.

cf login -a https://api.run.pivotal.io --skip-ssl-validation -o my-org -s development
API endpoint: https://api.run.pivotal.io

Email> myemail@gmail.com

Password>
Authenticating...
OK

Targeted org my-org

Targeted space development



API endpoint:   https://api.run.pivotal.io (API version: 2.80.0)
User:           myemail@gmail.com
Org:            my-org
Space:          development

回答1:

You can try with

cf login -a https://api.run.pivotal.io --skip-ssl-validation -o <Org_Name> -s <Space_Name>


回答2:

if you don't want to expose your password to command line.you can use sso validation. cf login -a https://api.run.pivotal.io -sso this will give you passcode with that you can do login. make sure you must login first, using your email in the browser.



回答3:

I solved it in Gitbash by calling cf login using winpty:

winpty cf login

HTH