cli icon indicating copy to clipboard operation
cli copied to clipboard

CLI login broken for local API dev

Open mars opened this issue 6 years ago • 5 comments

When working [internally] on the Heroku API, the local login flow is broken.

What is the current behavior?

When logging in, there's an https redirect to /account that fails, but really the login was successful.

$ export HEROKU_HOST=http://localhost:5000
$ DEBUG=* heroku login -i
…
heroku: Enter your login credentials
Email: [email protected]
Password: ****************
  http → POST http://localhost/oauth/authorizations
  http   accept: 'application/vnd.heroku+json; version=3'
  http   authorization: '[REDACTED]'
  http   content-length: '117'
  http   content-type: 'application/json'
  http   user-agent: 'heroku/7.21.0 darwin-x64 node-v11.9.0'
  http {"scope":["global"],"description":"Heroku CLI login from marshall-wsm.internal.salesforce.com","expires_in":31536000} +18s
  http ← POST http://localhost/oauth/authorizations 201
  http   cache-control: 'private, no-cache'
  http   connection: 'close'
  http   content-length: '501'
  http   content-type: 'application/json'
  http   date: 'Fri, 08 Mar 2019 20:00:13 GMT'
  http   ratelimit-multiplier: '1'
  http   ratelimit-remaining: '29'
  http   request-id: '853c8e61-b818-4c65-a4ef-f38a0f8facf8'
  http   vary: 'Accept-Encoding'
  http   x-content-type-options: 'nosniff'
  http   x-runtime: '0.654474'
  http { access_token:
  http    { expires_in: 31535999,
  http      id: 'xxxxx',
  http      token: 'xxxxx' },
  http   client: null,
  http   created_at: '2019-03-08T20:00:13Z',
  http   description: 'Heroku CLI login from marshall-wsm.internal.salesforce.com',
  http   grant: null,
  http   id: 'xxxxx',
  http   refresh_token: null,
  http   session: null,
  http   scope: [ 'global' ],
  http   updated_at: '2019-03-08T20:00:13Z',
  http   user:
  http    { id: 'xxxxx',
  http      email: '[email protected]',
  http      full_name: null } } +663ms
  netrc-parser save /Users/mars.hall/.netrc +19s
  http → GET https://localhost:5000/account
  http   accept: 'application/vnd.heroku+json; version=3'
  http   authorization: '[REDACTED]'
  http   user-agent: 'heroku-cli/7.21.0 darwin' +3ms
  http Error: getaddrinfo ENOTFOUND localhost:5000 localhost:5000:443
  http     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:58:26) +14ms
  http → GET https://localhost:5000/account
  http   accept: 'application/vnd.heroku+json; version=3'
  http   authorization: '[REDACTED]'
  http   user-agent: 'heroku-cli/7.21.0 darwin' +278ms
  http Error: getaddrinfo ENOTFOUND localhost:5000 localhost:5000:443

What is the expected behavior?

Login succeeds normally.

mars avatar Mar 11 '19 22:03 mars

We're also having this problem. Is there an additional env var we can set apart from HEROKU_HOST to get this to work?

dmcinnes avatar Apr 03 '19 22:04 dmcinnes

Someone suggested that I try HEROKU_API_URL=http://localhost:5000 at one point.

mars avatar Apr 03 '19 23:04 mars

We tried that as well, didn't seem to have an affect.

dmcinnes avatar Apr 03 '19 23:04 dmcinnes

is this what you guys are looking for? https://github.com/heroku/heroku-cli-cloud

EDIT: nevermind, the issue here is that the login is using https when it should be using http. I think it's on this line

jdx avatar Apr 09 '19 17:04 jdx

Hello folks, I seem to still be running into this issue, is there a work-around?

dmcinnes avatar Aug 27 '20 18:08 dmcinnes