Links

Global Corbado object

To access authentication state or trigger authentication related methods (e.g. a logout) you will always make use of the Corbado object.

API reference

Name
Type
Description
load
Promise<void>
Initializes the SDK. Takes your projectId as 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.
isAuthenticated
boolean
Indicates if the user is logged in. Changes when a user logs in, logs out or when her session expires.
user
SessionUser | undefined
On object that holds basic information about the user. A value of undefined indicates that the user is not logged in.
shortSession
string | undefined
A 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.
authStateChanges
BehaviourSubject<AuthState>
Like isAuthenticated it also indicated 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.
userChanges
BehaviourSubject<SessionUser|undefined>
Listen to userChanges to be informed about changes to the user object. As this object is derived from the shortSession is changes every time the session is refreshed by the SDK.
shortSessionChanges
BehaviourSubject<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.
logout
void
Logs the user out of your application and cleans all local authentication state.
mountAuthUI
void
Mounts the <CorbadoAuth/> component to your DOM.
mountSignUpUI
void
Mounts the <SignUp/> component to your DOM.
mountLoginUI
void
Mounts the <Login/> component to your DOM.
mountPasskeyList
void
Mounts the <PasskeyList/> component to your DOM.