API reference

NameTypeDescription
loadPromise<void>Initializes the SDK. Takes your projectId as a mandatory parameter. For a list of additional optional parameters take a look at the API reference of CorbadoProvider (they share the same parameters). Load must be called before you can use any of the other methods.
mountAuthUIvoidMounts the CorbadoAuth component to your DOM.
mountPasskeyListvoidMounts the PasskeyList component to your DOM.
isAuthenticatedbooleanIndicates if the user is logged in. Changes when a user logs in, logs out, or when her session expires.
userSessionUser | undefinedAn object that holds basic information about the user. A value of undefined indicates that the user is not logged in.
shortSessionstring | undefinedA JWT that proves that the user is authenticated. It can be used to make calls to your backend and thus should be included as an Authorization Header in the requests to such a backend. A value of undefined indicates that the user is not logged in.
authStateChangesBehaviourSubject<AuthState>Like isAuthenticated, it also indicates if the user is logged in. As it is a BehaviourSubject, you can listen to it to be informed about changes to the user’s authentication state.
userChangesBehaviourSubject <SessionUser|undefined>Listen to userChanges to be informed about changes to the user object. As this object is derived from the shortSession, it changes every time the session is refreshed by the SDK.
shortSessionChangesBehaviourSubject <string|undefined>Listen to shortSessionChanges to be informed about changes to the shortSession object. It changes every time the session is refreshed by the SDK.
logoutvoidLogs the user out of your application and cleans all local authentication state.

In addition to CorbadoProvider parameter, load also support onError callback which can be used to fetch global errors in the Corbado components. This is useful if you want to show a customised screen in case of failure.