docmeup / laravel-connector-bitbucket
Creates ready-to-go bitbucket app connector endpoints
Requires
- laravel/framework: 5.8.*
Suggests
- firebase/php-jwt: 5.0.*
This package is auto-updated.
Last update: 2025-01-30 18:19:24 UTC
README
Learn more about Integrating with Bitbucket Cloud.
Install
- Get package via composer:
composer require docmeup/laravel-connector-bitbucket
- Initialize default config and routes:
artisan vendor:publish --tag docmeup-connector-bitbucket
Confirm Routes
You should have a new route file that manages request to /connector
at ./routes/connector.php
artisan route:list
should return:
GET|HEAD | connector/bitbucket/atlassian-connect.json
POST | connector/bitbucket/installed
POST | connector/bitbucket/uninstalled
{tip} Your Bitbucket "describe URI" should be accessible:
https://{APP_URL}/connector/bitbucket/atlassian-connect.json
{tip} Bitbucket will post their app secret to the
installed
endpoint. Your app should store this to authenticate Bitbucket requests using JWT authentication.
Confirm Config
A new file should be available at ./config/gitconnector.php
.
config('gitconnector.bitbucket.connector')
determines the output of connector/bitbucket/atlassian-connect.json
by default. You can assign new logic in ./routes/connector.php
.
Noteworthy
X-Frame-Options
The default config instructs Bitbucket to make cross-origin request to your Laravel website. The X-Frame-Options
header needs to be set accordingly. A value of ALLOWALL
on the connector/bitbucket
route will help you debug most quickly.
Testing
- Expose your project to the web using a service such as Ngrok or LocalTunnel.me
- Add the add-on to your account:
- Click "Create App" at
https://bitbucket.org/account/user/{YOUR_USER}/applications
- Provide the describe URI:
https://{NGROK_HOST}/connector/bitbucket/atlassian-connect.json
- Click "Create App" at
- Bitbucket will provide you with a cliend ID and secret. Update your
.env
-
# NGROK or LocalTunnel.me host. Example: https://smooth-host-1234.localtunnel.me GITCONNECTOR_BITBUCKET_HOST= GITCONNECTOR_BITBUCKET_CLIENT_ID= GITCONNECTOR_BITBUCKET_CLIENT_SECRET=
-
- Click "Install app from URL" at
https://bitbucket.org/account/user/{YOUR_USER}/addon-management
- Provide the describe URI:
https://{NGROK_HOST}/connector/bitbucket/atlassian-connect.json
What You Should See in Bitbucket
- Visit one of your repositories. "Example Page YAS" and "Example Web Item" will be visible in the left-hand navigation menu.
- Visit your repository Source page. You should see "Loading add-on Demo Laravel Add-on"