Dropbox OAuth provider

OAuth integration for Dropbox. Provider id is dropbox.

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

const dropboxAuth = dropbox(auth, configs);

dropbox()#

Scope account_info.read is always included.

const dropbox: (
	auth: Auth,
	configs: {
		clientId: string;
		clientSecret: string;
		redirectUri: string;
		scope?: string[];
		tokenAccessType?: "online" | "offline";
	}
) => DropboxProvider;
Parameters#
nametypedescriptionoptionaldefault
authAuthLucia instance
config.clientIdstringDropbox OAuth app client id
config.clientSecretstringDropbox OAuth app client secret
config.redirectUristringan authorized redirect URI
config.scopestring[]an array of scopes
config.tokenAccessType"online" | "offline"set to "offline" to get refresh tokens"online"
Returns#
typedescription
DropboxProviderDropbox provider

Interfaces#

DropboxAuth#

See OAuth2ProviderAuth.

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

DropboxTokens#

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

DropboxUser#

type DropboxUser = PairedDropBoxUser | UnpairedDropboxUser;
type PairedDropBoxUser = BaseDropboxUser & {
	is_paired: true;
	team: {
		id: string;
		name: string;
		office_addin_policy: Record<string, string>;
		sharing_policies: Record<string, Record<string, string>>;
	};
};

type UnpairedDropboxUser = BaseDropboxUser & {
	is_paired: false;
};

type BaseDropboxUser = {
	account_id: string;
	country: string;
	disabled: boolean;
	email: string;
	email_verified: boolean;
	locale: string;
	name: {
		abbreviated_name: string;
		display_name: string;
		familiar_name: string;
		given_name: string;
		surname: string;
	};
	profile_photo_url: string;
};

DropboxUserAuth#

Extends ProviderUserAuth.

interface DropboxUserAuth<_Auth extends Auth> extends ProviderUserAuth<_Auth> {
	dropboxUser: DropboxUser;
	dropboxTokens: DropboxTokens;
}
propertiestypedescription
dropboxUserDropboxUserDropbox user
dropboxTokensDropboxTokensAccess tokens etc
Generics#
nameextends
_AuthAuth