chrome.loginState
- Description
Use the
chrome.loginState
API to read and monitor the login state. - Permissions
loginState
- AvailabilityChrome 78+
Summary
- Types
- Methods
- Events
Types
ProfileType
Type
"SIGNIN_PROFILE" "USER_PROFILE"
SessionState
Type
"UNKNOWN" "IN_OOBE_SCREEN" "IN_LOGIN_SCREEN" "IN_SESSION" "IN_LOCK_SCREEN" "IN_RMA_SCREEN"
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>
PendingThis only returns a
Promise
when thecallback
parameter is not specified, and with MV3+. The type inside thePromise
is the same as the 1st argument tocallback
.
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>
PendingThis only returns a
Promise
when thecallback
parameter is not specified, and with MV3+. The type inside thePromise
is the same as the 1st argument tocallback
.
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