{"id":23098920,"url":"https://github.com/mrjoops/oauth2-jira","last_synced_at":"2025-08-16T12:33:51.730Z","repository":{"id":56720772,"uuid":"156380369","full_name":"mrjoops/oauth2-jira","owner":"mrjoops","description":"Jira OAuth 2.0 support for the PHP League's OAuth 2.0 Client","archived":false,"fork":false,"pushed_at":"2021-05-18T09:03:51.000Z","size":18,"stargazers_count":4,"open_issues_count":3,"forks_count":5,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-07-04T16:46:30.466Z","etag":null,"topics":["composer","jira","oauth","oauth2","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrjoops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-06T12:28:48.000Z","updated_at":"2024-01-17T08:30:03.000Z","dependencies_parsed_at":"2022-08-16T00:20:15.658Z","dependency_job_id":null,"html_url":"https://github.com/mrjoops/oauth2-jira","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/mrjoops/oauth2-jira","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjoops%2Foauth2-jira","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjoops%2Foauth2-jira/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjoops%2Foauth2-jira/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjoops%2Foauth2-jira/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrjoops","download_url":"https://codeload.github.com/mrjoops/oauth2-jira/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjoops%2Foauth2-jira/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270709083,"owners_count":24631992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composer","jira","oauth","oauth2","php"],"created_at":"2024-12-16T23:14:55.264Z","updated_at":"2025-08-16T12:33:51.284Z","avatar_url":"https://github.com/mrjoops.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jira Provider for OAuth 2.0 Client\n\n[![Latest Version](https://img.shields.io/github/tag/mrjoops/oauth2-jira.svg?style=flat-square)](https://github.com/mrjoops/oauth2-jira/releases)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/mrjoops/oauth2-jira/develop.svg?style=flat-square)](https://travis-ci.org/mrjoops/oauth2-jira)\n[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/mrjoops/oauth2-jira.svg?style=flat-square)](https://scrutinizer-ci.com/g/mrjoops/oauth2-jira/code-structure)\n[![Quality Score](https://img.shields.io/scrutinizer/g/mrjoops/oauth2-jira.svg?style=flat-square)](https://scrutinizer-ci.com/g/mrjoops/oauth2-jira)\n\nThis package provides Jira OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).\n\n## Installation\n\nTo install, use composer:\n\n```\ncomposer require mrjoops/oauth2-jira\n```\n\n## Usage\n\nUsage is the same as The League's OAuth client, using `\\Mrjoops\\OAuth2\\Client\\Provider\\Jira` as the provider.\n\n### Authorization Code Flow\n\n```php\n$provider = new Mrjoops\\OAuth2\\Client\\Provider\\Jira([\n    'clientId'          =\u003e '{jira-client-id}',\n    'clientSecret'      =\u003e '{jira-client-secret}',\n    'redirectUri'       =\u003e 'https://example.com/callback-url',\n]);\n\nif (!isset($_GET['code'])) {\n\n    // If we don't have an authorization code then get one\n    $authUrl = $provider-\u003egetAuthorizationUrl();\n    $_SESSION['oauth2state'] = $provider-\u003egetState();\n    header('Location: '.$authUrl);\n    exit;\n\n// Check given state against previously stored one to mitigate CSRF attack\n} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {\n\n    unset($_SESSION['oauth2state']);\n    exit('Invalid state');\n\n} else {\n\n    // Try to get an access token (using the authorization code grant)\n    $token = $provider-\u003egetAccessToken('authorization_code', [\n        'code' =\u003e $_GET['code']\n    ]);\n\n    // Optional: Now you have a token you can look up a users profile data\n    try {\n\n        // We got an access token, let's now get the user's details\n        $user = $provider-\u003egetResourceOwner($token);\n\n        // Use these details to create a new profile\n        printf('Hello %s!', $user-\u003egetNickname());\n\n    } catch (Exception $e) {\n\n        // Failed to get user details\n        exit('Oh dear...');\n    }\n\n    // Use this to interact with an API on the users behalf\n    echo $token-\u003egetToken();\n}\n```\n\n### Managing Scopes\n\nWhen creating your Jira authorization URL, you can specify the state and scopes your application may authorize.\n\n```php\n$options = [\n    'state' =\u003e 'OPTIONAL_CUSTOM_CONFIGURED_STATE',\n    'scope' =\u003e ['read:jira-user','read:jira-work] // array or string\n];\n\n$authorizationUrl = $provider-\u003egetAuthorizationUrl($options);\n```\nIf neither are defined, the provider will utilize internal defaults.\n\nAt 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).\n\n- read:jira-user\n- read:jira-work\n- write:jira-work\n- manage:jira-project\n- manage:jira-configuration\n\n### Jira Cloud API call\n\nSince your Jira Cloud API URL vary, you can get it using the `getApiUrl()` method of the provider.\n\n```php\n$request = $provider-\u003egetAuthenticatedRequest(\n    \\Mrjoops\\OAuth2\\Client\\Provider\\Jira::METHOD_GET,\n    $provider-\u003egetApiUrl().'/rest/api/3/myself',\n    $token\n);\n\n```\n\n## Testing\n\n``` bash\n$ ./vendor/bin/phpunit\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/mrjoops/oauth2-jira/blob/develop/CONTRIBUTING.md) for details.\n\n## Credits\n\n- [Alexandre Lahure](https://github.com/mrjoops)\n- [All Contributors](https://github.com/mrjoops/oauth2-jira/contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](https://github.com/mrjoops/oauth2-jira/blob/develop/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrjoops%2Foauth2-jira","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrjoops%2Foauth2-jira","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrjoops%2Foauth2-jira/lists"}