Box OAuth provider

OAuth integration for Box. Provider id is box.

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

const boxAuth = box(auth, configs);

box()#

const box: (
	auth: Auth,
	configs: {
		clientId: string;
		clientSecret: string;
		redirectUri: string;
	}
) => BoxProvider;
Parameters#
nametypedescription
authAuthLucia instance
config.clientIdstringBox OAuth app client id
config.clientSecretstringBox OAuth app client secret
config.redirectUristringan authorized redirect URI
Returns#
typedescription
BoxProviderBox provider

Interfaces#

BoxAuth#

See OAuth2ProviderAuth.

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

BoxTokens#

type BoxTokens = {
	accessToken: string;
};

BoxUser#

type BoxUser = {
	id: string;
	type: "user";
	address: string;
	avatar_url: string;
	can_see_managed_users: boolean;
	created_at: string;
	enterprise: {
		id: string;
		type: string;
		name: string;
	};
	external_app_user_id: string;
	hostname: string;
	is_exempt_from_device_limits: boolean;
	is_exempt_from_login_verification: boolean;
	is_external_collab_restricted: boolean;
	is_platform_access_only: boolean;
	is_sync_enabled: boolean;
	job_title: string;
	language: string;
	login: string;
	max_upload_size: number;
	modified_at: string;
	my_tags: [string];
	name: string;
	notification_email: {
		email: string;
		is_confirmed: boolean;
	};
	phone: string;
	role: string;
	space_amount: number;
	space_used: number;
	status:
		| "active"
		| "inactive"
		| "cannot_delete_edit"
		| "cannot_delete_edit_upload";
	timezone: string;
	tracking_codes: {
		type: string;
		name: string;
		value: string;
	}[];
};

BoxUserAuth#

Extends ProviderUserAuth.

interface BoxUserAuth<_Auth extends Auth> extends ProviderUserAuth<_Auth> {
	boxUser: BoxUser;
	boxTokens: BoxTokens;
}
propertiestypedescription
boxUserBoxUserBox user
boxTokensBoxTokensAccess tokens etc
Generics#
nameextends
_AuthAuth