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#
| name | type | description | optional | default | 
|---|
auth | Auth | Lucia instance |  |  | 
config.clientId | string | Dropbox OAuth app client id |  |  | 
config.clientSecret | string | Dropbox OAuth app client secret |  |  | 
config.redirectUri | string | an authorized redirect URI |  |  | 
config.scope | string[] | an array of scopes | ✓ |  | 
config.tokenAccessType | "online" | "offline" | set to "offline" to get refresh tokens | ✓ | "online" | 
 
Returns#
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#
| name | extends | default | 
|---|
_Auth | Auth | Auth | 
 
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;
}
Generics#