# Invalid redirect uri when connecting to Bitbucket, Drone 0.5

**URL:** <https://drone.discourse.group/t/invalid-redirect-uri-when-connecting-to-bitbucket-drone-0-5/8416>\
**Category:** Drone Support\
**Created:** [February 21, 2017, 9:47pm UTC](https://drone.discourse.group/t/invalid-redirect-uri-when-connecting-to-bitbucket-drone-0-5/8416 "2017-02-21T21:47:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattcopas](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/mattcopas/32/6085_2.png) [@mattcopas](https://drone.discourse.group/u/mattcopas)\
**Post date:** [February 21, 2017, 9:47pm UTC](https://drone.discourse.group/t/invalid-redirect-uri-when-connecting-to-bitbucket-drone-0-5/8416/1 "2017-02-21T21:47:58Z")

</div>

I’ve been through the installation docs here:  
[http://readme.drone.io/admin/installation-guide/](http://readme.drone.io/admin/installation-guide/)  
And modified to account for the Bitbucket setup here:  
[http://readme.drone.io/admin/installation-guide/](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](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!

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [February 22, 2017, 6:49am UTC](https://drone.discourse.group/t/invalid-redirect-uri-when-connecting-to-bitbucket-drone-0-5/8416/2 "2017-02-22T06:49:47Z")

</div>

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/](http://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?

---

<div class="post-metadata">

**Author:** ![mattcopas](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/mattcopas/32/6085_2.png) [@mattcopas](https://drone.discourse.group/u/mattcopas)\
**Post date:** [March 7, 2017, 8:29pm UTC](https://drone.discourse.group/t/invalid-redirect-uri-when-connecting-to-bitbucket-drone-0-5/8416/3 "2017-03-07T20:29:14Z")

</div>

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
