Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[providers]: Add Atlassian #664

Merged
merged 4 commits into from
Sep 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/providers/atlassian.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export default (options) => {
return {
id: 'atlassian',
name: 'Atlassian',
type: 'oauth',
version: '2.0',
params: {
grant_type: 'authorization_code'
},
accessTokenUrl: 'https://auth.atlassian.com/oauth/token',
authorizationUrl:
'https://auth.atlassian.com/authorize?audience=api.atlassian.com&response_type=code&prompt=consent',
profileUrl: 'https://api.atlassian.com/me',
profile: (profile) => {
return {
id: profile.account_id,
name: profile.name,
email: profile.email,
image: profile.picture
}
},
...options
}
}
4 changes: 3 additions & 1 deletion src/providers/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Auth0 from './auth0'
import Apple from './apple'
import Atlassian from './atlassian'
import Auth0 from './auth0'
import Basecamp from './basecamp'
import BattleNet from './battlenet'
import Box from './box'
Expand All @@ -23,6 +24,7 @@ import Twitter from './twitter'
import Yandex from './yandex'

export default {
Atlassian,
Auth0,
Apple,
Basecamp,
Expand Down
1 change: 1 addition & 0 deletions www/docs/configuration/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ NextAuth.js is designed to work with any OAuth service, it supports OAuth 1.0, 1
### Built-in providers

* [Apple](/providers/apple)
* [Atlassian](/providers/atlassian)
* [Auth0](/providers/auth0)
* [Basecamp](/providers/basecamp)
* [Battle.net](/providers/battlenet)
Expand Down
2 changes: 1 addition & 1 deletion www/docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ You can use also NextAuth.js with any database using a custom database adapter,

### What authentication services does NextAuth.js support?

NextAuth.js includes built-in support for signing in with Apple, Auth0, Google, Battle.net, Box, AWS Cognito, Discord, Facebook, FusionAuth, GitHub, GitLab, Google, Open ID Identity Server, Mixer, Okta, Slack, Spotify, Twitch, Twitter and Yandex.
NextAuth.js includes built-in support for signing in with Apple, Atlassian, Auth0, Google, Battle.net, Box, AWS Cognito, Discord, Facebook, FusionAuth, GitHub, GitLab, Google, Open ID Identity Server, Mixer, Okta, Slack, Spotify, Twitch, Twitter and Yandex.

NextAuth.js also supports email for passwordless sign in, which is useful for account recovery or for people who are not able to use an account with the configured OAuth services (e.g. due to service outage, account suspension or otherwise becoming locked out of an account).

Expand Down
43 changes: 43 additions & 0 deletions www/docs/providers/atlassian.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
id: atlassian
title: Atlassian
---

## Documentation

https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/#implementing-oauth-2-0--3lo-

## Example

For Jira Platform API access:

```js
import Providers from `next-auth/providers`
...
providers: [
Providers.Atlassian({
clientId: process.env.ATLASSIAN_CLIENT_ID,
clientSecret: process.env.ATLASSIAN_CLIENT_SECRET,
scope:
'write:jira-work read:jira-work read:jira-user offline_access read:me',
})
}
...
```

## Instructions

### Configuration

:::tip
An app can be created at https://developer.atlassian.com/apps/
:::

Under "Apis and features" side menu, configure the following for the "OAuth 2.0 (3LO)"

- Redirect URL
- http://localhost:3000/api/auth/callback/atlassian

:::warning
To enable access to Jira Platform REST API you must enable User Identity API and add `read:me` to your provider scope option.
:::
1 change: 1 addition & 0 deletions www/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
],
'Authentication Providers': [
'providers/apple',
'providers/atlassian',
'providers/auth0',
'providers/basecamp',
'providers/battle.net',
Expand Down