chrome.loginState

Description: Use the chrome.loginState API to read and monitor the login state.
Availability: Since Chrome 78.
Permissions: "loginState"

Important: This API works only on Chrome OS.

Summary

Types
SessionState
Methods
getProfileType chrome.loginState.getProfileType(function callback)
getSessionState chrome.loginState.getSessionState(function callback)
Events
onSessionStateChanged

Types

SessionState

Enum
"UNKNOWN"
The session state is unknown.
"IN_OOBE_SCREEN"
The user is in the out-of-box-experience screen.
"IN_LOGIN_SCREEN"
The user is in the login screen.
"IN_SESSION"
The user is in the session.
"IN_LOCK_SCREEN"
The user is in the lock screen.

Methods

getProfileType

chrome.loginState.getProfileType(function callback)

Gets the type of the profile the extension is in.

Parameters
function callback

The callback parameter should be a function that looks like this:

function(enum of "SIGNIN_PROFILE", or "USER_PROFILE" result) {...};
enum of "SIGNIN_PROFILE", or "USER_PROFILE" result
SIGNIN_PROFILE
The extension is in the signin profile.
USER_PROFILE
The extension is in the user profile.

getSessionState

chrome.loginState.getSessionState(function callback)

Gets the current session state.

Parameters
function callback

The callback parameter should be a function that looks like this:

function( SessionState result) {...};
SessionState result

Events

onSessionStateChanged

Dispatched when the session state changes. sessionState is the new session state.

addListener

chrome.loginState.onSessionStateChanged.addListener(function callback)
Parameters
function callback

The callback parameter should be a function that looks like this:

function( SessionState sessionState) {...};
SessionState sessionState