Description
Use the chrome.loginState
API to read and monitor the login state.
Permissions
loginState
Availability
Types
ProfileType
Enum
"SIGNIN_PROFILE" "USER_PROFILE"
Specifies that the extension is in the signin profile.
Specifies that the extension is in the user profile.
SessionState
Enum
"UNKNOWN" "IN_OOBE_SCREEN" "IN_LOGIN_SCREEN" "IN_SESSION" "IN_LOCK_SCREEN" "IN_RMA_SCREEN"
Specifies that the session state is unknown.
Specifies that the user is in the out-of-box-experience screen.
Specifies that the user is in the login screen.
Specifies that the user is in the session.
Specifies that the user is in the lock screen.
Specifies that the device is in RMA mode, finalizing repairs.
Methods
getProfileType()
chrome.loginState.getProfileType(
callback?: function,
)
Gets the type of the profile the extension is in.
Parameters
-
callback
function optional
The
callback
parameter looks like:(result: ProfileType) => void
-
result
-
Returns
-
Promise<ProfileType>
Chrome 96+Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility. You cannot use both on the same function call. The promise resolves with the same type that is passed to the callback.
getSessionState()
chrome.loginState.getSessionState(
callback?: function,
)
Gets the current session state.
Parameters
-
callback
function optional
The
callback
parameter looks like:(result: SessionState) => void
-
result
-
Returns
-
Promise<SessionState>
Chrome 96+Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility. You cannot use both on the same function call. The promise resolves with the same type that is passed to the callback.
Events
onSessionStateChanged
chrome.loginState.onSessionStateChanged.addListener(
callback: function,
)
Dispatched when the session state changes. sessionState
is the new session state.
Parameters
-
callback
function
The
callback
parameter looks like:(sessionState: SessionState) => void
-
sessionState
-