{"id":18524368,"url":"https://github.com/omniauth/omniauth-atlassian-oauth2","last_synced_at":"2025-04-09T11:32:01.778Z","repository":{"id":56886335,"uuid":"172783967","full_name":"omniauth/omniauth-atlassian-oauth2","owner":"omniauth","description":"OmniAuth strategy for Atlassian's modern OAuth 2.0 APIs (Jira)","archived":false,"fork":false,"pushed_at":"2023-06-22T07:53:06.000Z","size":13,"stargazers_count":8,"open_issues_count":1,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T03:18:01.434Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://developer.atlassian.com/apps/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/omniauth.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-02-26T20:18:50.000Z","updated_at":"2025-02-03T16:09:13.000Z","dependencies_parsed_at":"2023-07-22T01:03:58.275Z","dependency_job_id":null,"html_url":"https://github.com/omniauth/omniauth-atlassian-oauth2","commit_stats":null,"previous_names":["aguynamedben/omniauth-atlassian-oauth2"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omniauth%2Fomniauth-atlassian-oauth2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omniauth%2Fomniauth-atlassian-oauth2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omniauth%2Fomniauth-atlassian-oauth2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omniauth%2Fomniauth-atlassian-oauth2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omniauth","download_url":"https://codeload.github.com/omniauth/omniauth-atlassian-oauth2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248031642,"owners_count":21036446,"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","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":[],"created_at":"2024-11-06T17:41:06.458Z","updated_at":"2025-04-09T11:32:01.379Z","avatar_url":"https://github.com/omniauth.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"[![Gem Version](https://badge.fury.io/rb/omniauth-atlassian-oauth2.svg)](https://badge.fury.io/rb/omniauth-atlassian-oauth2)\n\n# OmniAuth Atlassian OAuth2 Strategy\n\nStrategy to authenticate with Atlassian via OAuth2 in OmniAuth.\n\nGet your API key at: https://developer.atlassian.com/apps/ Note the Client ID\nand the Client Secret.\n\nFor more details, read the Atlassian docs about OAuth 2.0 (3LO):\nhttps://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/\n\nNote that as of March 2019, the OAuth 2.0 APIs at in \"developer preview\" mode\nwith Atlassian. See\n[ACJIRA-1588](https://ecosystem.atlassian.net/browse/ACJIRA-1588) for updates.\n\n## Installation\n\nAdd to your `Gemfile`:\n\n```ruby\ngem 'omniauth-atlassian-oauth2'\n```\n\nThen `bundle install`.\n\n## Atlassian API Setup\n\n* Go to 'https://developer.atlassian.com/apps/'\n* Create a new app.\n* Note the Client ID and Secret values in the App Details section.\n* Under APIs and Features, add the \"Authorization code grants\" feature.\n  Configure the feature with your callback URL (something like\n  http://localhost:3000/auth/atlassian_oauth2/callback).\n* Under APIs and Features, add the \"Jira platform REST API\" API. Configure the\n  API by adding the \"View Jira issue data\" and \"View user profiles\" scopes. These coincide with the scopes listed in the [Jira scopes](https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/) section of the Atlassian Docs. Add additional scopes in this UI as needed.\n\n## Usage\n\nHere's an example for adding the middleware to a Rails app in\n`config/initializers/omniauth.rb`:\n\n```ruby\nRails.application.config.middleware.use OmniAuth::Builder do\n  provider :atlassian_oauth2, ENV['ATLASSIAN_CLIENT_ID'], ENV['ATLASSIAN_CLIENT_SECRET'],\n    scope: \"offline_access read:jira-user read:jira-work\",\n    prompt: \"consent\"\nend\n```\n\nThis OmniAuth strategy makes API calls that require the `read:jira-user` scope,\nso that scope must be included by you in your OmniAuth configuration. The\n`offline_access` scope must be included if you wish to attain a refresh token.\nYou may wish to include additional scopes depending on how you've configured\nyour app in the Atlassian UI.\n\nYou can now access the OmniAuth Atlassian OAuth2 URL: `/auth/atlassian_oauth2`\n\nNOTE: While developing your application, if you change the scope in the\ninitializer you will need to restart your app server. Remember that either the\n'email' or 'profile' scope is required!\n\n## Auth Hash\n\nHere's an example of an authentication hash available in the callback by\naccessing `request.env['omniauth.auth']`:\n\nNote: Atlassian's OAuth2 flow grants access to potentially many Atlassian\n\"sites\", and each site defines a user on its own. There's no single definitive\nprofile of the user. We must loop through the sites and call the\n`/rest/api/3/myself` endpoint for each. `auth_hash['extra']['raw_info']['site']`\nis the site that was used to populate `auth_hash['info']` and\n`auth_hash['uid']`. `auth_hash['extra']['raw_info']['sites']` is the data for\nall the sites available for the user.\n\nAfter authing a user, when you make API calls over time, you should follow the\n[Atlassian OAuth 2.0 docs](https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/)\nand continue to check the `accessible-resources` endpoint to ensure your app\ncontinues to have access to the sites you expect.\n\n```ruby\n{\n  \"provider\" =\u003e \"atlassian_oauth2\",\n  \"uid\" =\u003e \"100000000000000000000\",\n  \"info\" =\u003e {\n    \"name\" =\u003e \"John Smith\",\n    \"email\" =\u003e \"john@example.com\",\n    \"nickname\" =\u003e \"john_smith\", # username\n    \"location\" =\u003e \"Australia/Sydney\", # time zone\n    \"image\" =\u003e \"https://whatever.atlassiancdn.com/photo_48x48.jpg\", # 48x48 pixels\n  },\n  \"credentials\" =\u003e {\n    \"token\" =\u003e \"TOKEN\",\n    \"refresh_token\" =\u003e \"REFRESH_TOKEN\",\n    \"expires_at\" =\u003e 1496120719,\n    \"expires\" =\u003e true\n  },\n  \"extra\" =\u003e {\n    \"raw_info\" =\u003e {\n      \"site\" =\u003e {},\n      \"sites\" =\u003e {},\n      \"myself\" =\u003e {},\n    }\n  }\n}\n```\n\n## License\n\nCopyright (c) 2019 by Ben Standefer\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomniauth%2Fomniauth-atlassian-oauth2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomniauth%2Fomniauth-atlassian-oauth2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomniauth%2Fomniauth-atlassian-oauth2/lists"}