New in 1.41.0 (BETA)

ensureUserIsLoggedIn()

Verifies the log-in status of the current user and triggers a login, if the user is not logged in.

Scrivito.ensureUserIsLoggedIn determines if the user is logged in. If this is not the case, it automatically redirects the browser to the log-in page of IAM or the custom identity provider. If the user is already logged in, nothing happens.

A website offering visitors to optionally log in would trigger this API method via a login button.

A website requiring visitors to log in would call this API method when the app initializes.

A protected page on a public website would call this API method prior to rendering the page component.

Returns

Void

Throws

ScrivitoError if this function is called under Node.js.

See also

Visitor Authentication with IAM

Scrivito.isUserLoggedIn