cloudfoundry / cli

The official command line client for Cloud Foundry
https://docs.cloudfoundry.org/cf-cli
Apache License 2.0
1.75k stars 928 forks source link

Can't login to Predix from the Cloud Foundry CLI #1148

Closed lazycatit closed 6 years ago

lazycatit commented 7 years ago

I'm trying to login Cloud Foundry endpoint. But when I connect by Cloud Foundry CLI, I get a error message below:

C:\Users\abc>cf login -a https://xxx.predix-
uaa.run.aws-usw02-pr.ice.predix.io
API endpoint: https://xxx.predix-uaa.run.aws-us
w02-pr.ice.predix.io

Not logged in. Use 'cf login' to log in.
FAILED
Error performing request: Get /login: unsupported protocol scheme ""

What can I do now? Please help!

And here is the JSON formatted list.

REQUEST: [2017-05-23T10:55:40+07:00]
GET /v2/info HTTP/1.1
Host: xxxx.predix-uaa.run.aws-usw02-pr.ice.predi
x.io
Accept: application/json
Connection: close
Content-Type: application/json
User-Agent: go-cli 6.26.0+9c9a261.2017-04-06 / windows

REQUEST: [2017-05-23T10:55:42+07:00]
GET /login HTTP/0.0
Host: 48b86784-10a9-49b4-8ef2-b9296985e506.predix-uaa.run.aws-usw02-pr.ice.predi
x.io
Accept: application/json
Connection: close
Referer: https://xxxx.predix-uaa.run.aws-usw02-p
r.ice.predix.io/v2/info
User-Agent: go-cli 6.26.0+9c9a261.2017-04-06 / windows

RESPONSE: [2017-05-23T10:55:43+07:00]
HTTP/1.1 200 OK
Connection: close
Content-Length: 505
Cache-Control: no-store
Content-Language: en-US
Content-Type: application/json;charset=UTF-8
Date: Tue, 23 May 2017 03:55:42 GMT
Server: Apache-Coyote/1.1
Set-Cookie: X-Uaa-Csrf=QrjggDbuySiReJ48pkVEDp; Expires=Thu, 22-Jun-2017 03:55:42
 GMT; HttpOnly
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-B3-Traceid: 88078622d3133150
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Vcap-Request-Id: 2a605c7e-dbd0-4188-67d9-576b384e33bd
X-Xss-Protection: 1; mode=block

{"app":{"version":"3.16.0"},"links":{"uaa":"https://xxxx.predix-uaa.run.aws-usw02-pr.ice.predix.io","passwd":"/forgot_password",
"login":"https://predix-uaa.run.aws-usw02-pr.ice.predix.io"},"zone_name":"48b867
84-10a9-49b4-8ef2-b9296985e506","entityID":"48b86784-10a9-49b4-8ef2-b9296985e506
.cloudfoundry-saml-login","commit_id":"4402a4b","idpDefinitions":{},"prompts":{"
username":["text","Username"],"password":["password","Password"]},"timestamp":"2
017-05-18T11:54:29-0700"}

REQUEST: [2017-05-23T10:55:43+07:00]
GET /login HTTP/1.1
Accept: application/json
Connection: close
Content-Type: application/json
User-Agent: go-cli 6.26.0+9c9a261.2017-04-06 / windows
cf-gitbot commented 7 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/145904799

The labels on this github issue will be updated when the story is started.

dkoper commented 7 years ago

The issue is likely that you are not specifying the correct CF API endpoint url. Please contact your platform operator to confirm what it should be.

We'll improve the error message, but what seems to be happening is that the cf CLI tries to retrieve a json configuration from [api-endpoint]/v2/info, but not getting the response it expects. It then builds a URL to the login endpoint from the "authorization_endpoint" that should be advertised in that json configuration. As that field is not in your response, it tries to access "/login" instead of e.g. "https://xxx.predix-uaa.run.aws-usw02-pr.ice.predix.io/login", causing the error.

CF endpoint urls generally start with "api.". In fact, I've never seen one starting differently.

dkoper commented 6 years ago

Closing, assuming no longer an issue.