Need help finding redirect URI for Discord bot web application.

Hi everyone, I am remotely hosting my Discord bot on Fly.io, but in order to use a dashboard I cannot use localhost and must instead use a redirect URI that will work for a project hosted on Fly.io. I generated a ipv4 address using flyctl ips allocate-v4. It is a shared ipv4 address because this project is intended to remain free. If I have an address in the form xx.xxx.xxx.xx, what should the port and overall URI be for the project?

If you run fly status you can see the URL for your app next to Hostname. It will look like <app-name>.fly.dev

1 Like

Ok yes I see it and it is like you described. When I locally hosted the bot the URI was http://127.0.0.1:5000/callback would I just replace that with <app-name>.fly.dev or do I need more formatting? Also do I even need the ipv4 address I generated or should I just remove it? Thanks for your prompt reply!

Yup, just replace it with https://<app-name>.fly.dev/callback

Yes, you need an IP address to access your app. You’ll also want to make sure you have a service set up in your fly.toml, like so:

[[services]]
  internal_port = 5000
  protocol = "tcp"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

Usually fly launch creates this section for you automatically.

Thanks! I have fly.toml set up and it looks like this, so I’ll just use a URI in the style you suggested, thanks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.