Bitbucket OAuth provider

OAuth integration for Bitbucket. Provider id is bitbucket.

Make sure you enable scope account in your Bitbucket app settings.

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

const bitbucketAuth = bitbucket(auth, configs);

bitbucket()#

Scopes can only be configured from your Bitbucket app settings.

const bitbucket: (
	auth: Auth,
	configs: {
		clientId: string;
		clientSecret: string;
		redirectUri: string;
	}
) => BitbucketProvider;
Parameters#
nametypedescription
authAuthLucia instance
config.clientIdstringBitbucket OAuth app client id
config.clientSecretstringBitbucket OAuth app client secret
config.redirectUristringan authorized redirect URI
Returns#
typedescription
BitbucketProviderBitbucket provider

Interfaces#

BitbucketAuth#

See OAuth2ProviderAuth.

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

BitbucketTokens#

type BitbucketTokens = {
	accessToken: string;
	accessTokenExpiresIn: number;
	refreshToken: string;
};

BitbucketUser#

type BitbucketUser = {
	type: string;
	links: {
		avatar:
			| {}
			| {
					href: string;
					name: string;
			  };
	};
	created_on: string;
	display_name: string;
	username: string;
	uuid: string;
};

BitbucketUserAuth#

Extends ProviderUserAuth.

interface BitbucketUserAuth<_Auth extends Auth>
	extends ProviderUserAuth<_Auth> {
	bitbucketUser: BitbucketUser;
	bitbucketTokens: BitbucketTokens;
}
propertiestypedescription
bitbucketUserBitbucketUserBitbucket user
bitbucketTokensBitbucketTokensAccess tokens etc
Generics#
nameextends
_AuthAuth