ProviderUserAuth

interface ProviderUserAuth {
	createKey: (userId: string) => Promise<Key>;
	createUser: (options: {
		userId?: string;
		attributes: Lucia.DatabaseUserAttributes;
	}) => Promise<User>;
	getExistingUser: () => Promise<User | null>;
}

createKey()#

Creates a new key using the OAuth provider.

const createKey: (userId: string) => Promise<Key>;
Parameters#
nametypedescription
userIdstringUser to link the key to
Returns#
typedescription
KeyA new key

createUser()#

Creates a new user and a key using the OAuth provider.

const createUser: (options: {
	userId?: string;
	attributes: Lucia.DatabaseUserAttributes;
}) => Promise<User>;
Parameters#
nametypeoptionaldescription
options.userIdstringUser id of new user
options.attributesLucia.DatabaseUserAttributesUser attributes of the new user
Returns#
typedescription
UserA new user

getExistingUser()#

Returns a user linked to the provider account, if it exists.

Returns#
type
User| null