jonnx / laravel-socialite-atlassian
Laravel Socialite driver for Atlassian Connected Apps
Requires
- laravel/socialite: ^4.2
Requires (Dev)
- phpunit/phpunit: ^8.5@dev
- dev-master
- 1.0.0
- dev-dependabot/npm_and_yarn/qs-6.5.3
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/ajv-6.12.6
- dev-dependabot/npm_and_yarn/node-fetch-2.6.7
- dev-dependabot/npm_and_yarn/tar-4.4.19
- dev-dependabot/npm_and_yarn/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/glob-parent-5.1.2
- dev-dependabot/npm_and_yarn/normalize-url-4.5.1
- dev-dependabot/npm_and_yarn/hosted-git-info-2.8.9
- dev-dependabot/npm_and_yarn/handlebars-4.7.7
- dev-dependabot/npm_and_yarn/ssri-6.0.2
- dev-dependabot/npm_and_yarn/y18n-3.2.2
- dev-dependabot/npm_and_yarn/ini-1.3.8
- dev-dependabot/npm_and_yarn/semantic-release-17.2.3
- dev-dependabot/npm_and_yarn/npm-user-validate-1.0.1
- dev-dependabot/npm_and_yarn/bin-links-1.1.8
- dev-dependabot/npm_and_yarn/npm-registry-fetch-4.0.5
- dev-dependabot/npm_and_yarn/npm-6.14.6
This package is auto-updated.
Last update: 2024-11-10 11:49:56 UTC
README
Leverage Laravel Socialtie to provide login and api access authorization for you application with the Connected Apps API for Atlassian Cloud products.
Getting Started
There are only a few steps to register the atlassian
socialite driver. After that you can leverage the generic Socialite implemententation to authenticate users.
Install Composer Package
composer require jonnx/laravel-socialite-atlassian
Update Configuration
You will need to add your client application configuration to the config/services.php
file. You can generate these keys registering
your application on https://developer.atlassian.com.
'atlassian' => [
'client_id' => env('ATLASSIAN_APP_ID'),
'client_secret' => env('ATLASSIAN_APP_SECRET'),
'redirect' => '/login/callback',
'base_uri' => 'https://id.atlassian.com',
],
Make sure you add & set the following 2 values in your .env
file:
ATLASSIAN_APP_ID=
ATLASSIAN_APP_SECRET=
Register Atlassian Socialite Driver
Update the AppServiceProvider.php
boot function to call a private method to extend Laravel Socialite with the new driver.
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->bootAtlassianSocialite();
}
private function bootAtlassianSocialite()
{
$socialite = $this->app->make('Laravel\Socialite\Contracts\Factory');
$socialite->extend(
'atlassian',
function ($app) use ($socialite) {
$config = $app['config']['services.atlassian'];
return $socialite->buildProvider(AtlassianSocialiteProvider::class, $config);
}
);
}
Done
Now you should be able to easily redirect users to Atlassian to login and request permissions:
return Socialite::with('atlassian')
->scopes([
'read:me',
'read:jira-work',
'write:jira-work'
'offline_access'
])
->redirect();
and resolve the user information from Atlassian on callback:
$atlassianUser = Socialite::driver('atlassian')->user();
License
The Laravel Socialite Atlassian driver is open-source software licensed under the MIT license.