Invalid redirect uri when connecting to Bitbucket, Drone 0.5

I’ve been through the installation docs here:
http://readme.drone.io/admin/installation-guide/
And modified to account for the Bitbucket setup here:
http://readme.drone.io/admin/installation-guide/

My docker-compose.yaml file is here:

version: ‘2’

services:
drone-server:
image: drone/drone:0.5
ports:
- 80:8000
volumes:
- ./drone:/var/lib/drone/
restart: always
environment:
- DRONE_OPEN=true
- DRONE_BITBUCKET=true
- DRONE_BITBUCKET_CLIENT=$(value_from_bitbucket_key)
- DRONE_BITBUCKET_SECRET=$(value_from_bitbucket_secret)
- DRONE_SECRET=$(secret)

drone-agent:
image: drone/drone:0.5
command: agent
restart: always
depends_on: [ drone-server ]
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- 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 readme.drone.io/admin/setup-reverse-proxy/

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