Invalid redirect uri when connecting to Bitbucket, Drone 0.5

I’ve been through the installation docs here:
And modified to account for the Bitbucket setup here:

My docker-compose.yaml file is here:

version: ‘2’

image: drone/drone:0.5
- 80:8000
- ./drone:/var/lib/drone/
restart: always
- DRONE_BITBUCKET_CLIENT=$(value_from_bitbucket_key)
- DRONE_BITBUCKET_SECRET=$(value_from_bitbucket_secret)
- DRONE_SECRET=$(secret)

image: drone/drone:0.5
command: agent
restart: always
depends_on: [ drone-server ]
- /var/run/docker.sock:/var/run/docker.sock
- DRONE_SERVER=ws://serverurl/ws/broker
- DRONE_SECRET=$(secret)

My auth callback url in Butbucket is set to http://serverurl/authorize

Running docker ps shows that both the server and agent are running.

but still I get the invalid_redirect_uri error from Bitbucket when logging in.

Please help!

The most common root causes for invalid redirect url are:

  1. incorrect redirect url in bitbucket, including incorrect path or scheme
  2. not checking all the correct boxes for permissions
  3. running drone behind a reverse proxy without properly configuring required headers. See

I can confirm for you that there are no bugs with the Bitbucket code, so incorrect configuration will be the only root cause here. So we just need to help you figure out what is misconfigured.

The easiest way to debug this is to look at the redirect_url value in your browser url bar when you are first redirected to the Bitbucket login. Does this match your actual Drone url? Does this match what you have configured in Bitbucket?

Finally found time to look into this…I was using an ip alias to access my drone page, so the redirect uri was using that alias, which is of course invalid as it wasn’t an actual domain name.

Thanks for your help