Atlassian OAuth provider

OAuth 2.0 (Authorization code) integration for Atlassian. Provider id is atlassian.

import { atlassian } from "@lucia-auth/oauth/providers";
import { auth } from "./lucia.js";

const atlassianAuth = atlassian(auth, configs);

atlassian()#

Scopes read:me is always included.

const atlassian: (
	auth: Auth,
	configs: {
		clientId: string;
		clientSecret: string;
		redirectUri: string;
		scope?: string[];
	}
) => AtlassianProvider;
Parameters#
nametypedescriptionoptional
authAuthLucia instance
config.clientIdstringAtlassian OAuth app client id
config.clientSecretstringAtlassian OAuth app client secret
config.redirectUristringan authorized redirect URI
config.scopestring[]an array of scopes
Returns#
typedescription
AtlassianProviderAtlassian provider

Interfaces#

AtlassianAuth#

See OAuth2ProviderAuth.

// implements OAuth2ProviderAuth<AtlassianAuth<_Auth>>
interface AtlassianAuth<_Auth extends Auth> {
	getAuthorizationUrl: () => Promise<readonly [url: URL, state: string]>;
	validateCallback: (code: string) => Promise<AtlassianUserAuth<_Auth>>;
}
Generics#
nameextendsdefault
_AuthAuthAuth

AtlassianTokens#

Add scope offline_access to get refresh tokens.

type AtlassianTokens = {
	accessToken: string;
	accessTokenExpiresIn: number;
	refreshToken: string | null;
};

AtlassianUser#

type AtlassianUser = {
	account_type: string;
	account_id: string;
	email: string;
	name: string;
	picture: string;
	account_status: string;
	nickname: string;
	zoneinfo: string;
	locale: string;
	extended_profile?: Record<string, string>;
};

AtlassianUserAuth#

Extends ProviderUserAuth.

interface AtlassianUserAuth<_Auth extends Auth>
	extends ProviderUserAuth<_Auth> {
	atlassianUser: AtlassianUser;
	atlassianTokens: AtlassianTokens;
}
propertiestypedescription
atlassianUserAtlassianUserAtlassian user
atlassianTokensAtlassianTokensAccess tokens etc
Generics#
nameextends
_AuthAuth