cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.69k stars 702 forks source link

🐛 BUG: `npx wrangler login` from remote machine still or again broken #5679

Open newsve opened 6 months ago

newsve commented 6 months ago

Which Cloudflare product(s) does this pertain to?

Wrangler core

What version(s) of the tool(s) are you using?

3.51.2

What version of Node are you using?

20.12.1

What operating system and version are you using?

macOS 14.4.1

Describe the Bug

Observed behavior

Please describe.

  1. Open Terminal on macOS
  2. ssh into your Ubuntu 22.04 VPS
  3. npx wrangler login
  4. Copy the link and paste it in Chrome Version v124
  5. Approve
  6. Copy link
  7. Paste link into second terminal on Ubuntu VPS
  8. get:
    ▲ [WARNING] Received query string parameter doesn't match the one sent! Possible malicious activity somewhere.

    Fwiw, I tried every possible permutation of the curl command.

Expected behavior

A successful login

related but closed again: https://github.com/cloudflare/workers-sdk/issues/2874

Please provide a link to a minimal reproduction

Follow aforementioned steps closely.

Please provide any relevant error logs

when running curl -v I got:

*   Trying 127.0.0.1:8976...
* connect to 127.0.0.1 port 8976 failed: Connection refused
*   Trying ::1:8976...
* Connected to localhost (::1) port 8976 (#0)
> GET /oauth/callback?code=[redacted] HTTP/1.1
> Host: localhost:8976
> User-Agent: curl/7.81.0
> Accept: */*
Frog-kt commented 5 months ago

@newsve Maybe a little different, but I have a similar problem on VS Code's DevContainer.

bgbruno commented 5 months ago

maybe help you this workaround https://developers.cloudflare.com/workers/wrangler/commands/#use-wrangler-login-on-a-remote-machine

gable-digital commented 4 months ago

@newsve Maybe a little different, but I have a similar problem on VS Code's DevContainer.

I'm also trying to do this in a VS Code DevContainer and having issues. If I open the URL in a browser and use the browser's dev tools to obtain the callback URL, then try to use curl to open the callback URL, it just hangs forever. I eventually get a timeout on the 'wrangler login' terminal, but it doesn't exit back to the prompt. The curl command is just hung there and doesn't time out. If I hit CTRL-C to exit curl, then the 'wrangler login' exits and goes back to a prompt, too.

This is the curl output:

It is clearly connecting to wrangler, but wrangler is not recognizing it or proceeding.

Also, it's worth noting that I tried this with and without the port forwarding from VS Code DevContainers.

aiden-liu commented 2 months ago

Also run in vscode devcontainer, I can't make it work using the workaround, but rather I configured the CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in .env, and works.