PHPackages                             raddevon/oauth2-jira - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. raddevon/oauth2-jira

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

raddevon/oauth2-jira
====================

Jira OAuth 2.0 support for the PHP League's OAuth 2.0 Client

v0.3.1(6y ago)030MITPHP

Since Nov 7Pushed 6y agoCompare

[ Source](https://github.com/raddevon/oauth2-jira)[ Packagist](https://packagist.org/packages/raddevon/oauth2-jira)[ RSS](/packages/raddevon-oauth2-jira/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependencies (4)Versions (9)Used By (0)

Jira Provider for OAuth 2.0 Client
==================================

[](#jira-provider-for-oauth-20-client)

[![Latest Version](https://camo.githubusercontent.com/fcab2d3013f24573960f281154d5d41707bf4fd7d048c90dec6e961b65e7efc3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f6d726a6f6f70732f6f61757468322d6a6972612e7376673f7374796c653d666c61742d737175617265)](https://github.com/mrjoops/oauth2-jira/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/7d355f05bcdb19f04bf870234b0cea741a1b91d8ed166cee0a716c8352b0641b/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6d726a6f6f70732f6f61757468322d6a6972612f646576656c6f702e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/mrjoops/oauth2-jira)[![Coverage Status](https://camo.githubusercontent.com/b5935180c37f9c90d3f3be9b83e1c267cbeb73a94728f94dd33b343d37ff8ac6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6d726a6f6f70732f6f61757468322d6a6972612e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/mrjoops/oauth2-jira/code-structure)[![Quality Score](https://camo.githubusercontent.com/66ea76abfe15d55e6b33a89b9a1a07fadac440dd15df8572835a7a3e436cd9a6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d726a6f6f70732f6f61757468322d6a6972612e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/mrjoops/oauth2-jira)

This package provides Jira OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client). This is a fork of [mrjoops/oauth2-jira](https://github.com/mrjoops/oauth2-jira), but I have pushed a new release to Packagist with the correct provider URLs.

Installation
------------

[](#installation)

To install, use composer:

```
composer require raddevon/oauth2-jira

```

Usage
-----

[](#usage)

Usage is the same as The League's OAuth client, using `\RadDevon\OAuth2\Client\Provider\Jira` as the provider.

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new RadDevon\OAuth2\Client\Provider\Jira([
    'clientId'          => '{jira-client-id}',
    'clientSecret'      => '{jira-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url',
]);

if (!isset($_GET['code'])) {

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl();
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: '.$authUrl);
    exit;

// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {

    unset($_SESSION['oauth2state']);
    exit('Invalid state');

} else {

    // Try to get an access token (using the authorization code grant)
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    // Optional: Now you have a token you can look up a users profile data
    try {

        // We got an access token, let's now get the user's details
        $user = $provider->getResourceOwner($token);

        // Use these details to create a new profile
        printf('Hello %s!', $user->getNickname());

    } catch (Exception $e) {

        // Failed to get user details
        exit('Oh dear...');
    }

    // Use this to interact with an API on the users behalf
    echo $token->getToken();
}
```

### Managing Scopes

[](#managing-scopes)

When creating your Jira authorization URL, you can specify the state and scopes your application may authorize.

```
$options = [
    'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE',
    'scope' => ['read:jira-user','read:jira-work] // array or string
];

$authorizationUrl = $provider->getAuthorizationUrl($options);
```

If neither are defined, the provider will utilize internal defaults.

At the time of authoring this documentation, the [following scopes are available](https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/#implementing-oauth-2-0-authorization-code-grants).

- read:jira-user
- read:jira-work
- write:jira-work
- manage:jira-project
- manage:jira-configuration

### Jira Cloud API call

[](#jira-cloud-api-call)

Since your Jira Cloud API URL vary, you can get it using the `getApiUrl()` method of the provider.

```
$request = $provider->getAuthenticatedRequest(
    \RadDevon\OAuth2\Client\Provider\Jira::METHOD_GET,
    $provider->getApiUrl().'/rest/api/3/myself',
    $token
);
```

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/raddevon/oauth2-jira/blob/develop/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Alexandre Lahure](https://github.com/mrjoops)
- [All Contributors](https://github.com/mrjoops/oauth2-jira/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/raddevon/oauth2-jira/blob/develop/LICENSE) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~66 days

Recently: every ~115 days

Total

8

Last Release

2281d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/49c0f69646d475909fdddc2b12f22439196dac428d2420bc3114d7aec657a29b?d=identicon)[raddevon](/maintainers/raddevon)

---

Top Contributors

[![mrjoops](https://avatars.githubusercontent.com/u/7291430?v=4)](https://github.com/mrjoops "mrjoops (11 commits)")[![raddevon](https://avatars.githubusercontent.com/u/2027711?v=4)](https://github.com/raddevon "raddevon (2 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationjira

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/raddevon-oauth2-jira/health.svg)

```
[![Health](https://phpackages.com/badges/raddevon-oauth2-jira/health.svg)](https://phpackages.com/packages/raddevon-oauth2-jira)
```

###  Alternatives

[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[omines/oauth2-gitlab

GitLab OAuth 2.0 Client Provider for The PHP League OAuth2-Client

36721.5k13](/packages/omines-oauth2-gitlab)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
