Welcome What's new in Chrome extensions Getting started API Reference Samples

chrome.loginState

  • Description

    Use the chrome.loginState API to read and monitor the login state.

  • Permissions
    loginState
  • Availability
    Chrome 78+

Summary

Types

ProfileType

Type

"SIGNIN_PROFILE"

, or

"USER_PROFILE"

SessionState

Type

"UNKNOWN"

,

"IN_OOBE_SCREEN"

,

"IN_LOGIN_SCREEN"

,

"IN_SESSION"

,

"IN_LOCK_SCREEN"

,
or

"IN_RMA_SCREEN"

Methods

getProfileType

chrome.loginState.getProfileType(
  callback?: function,
)
Promise

Gets the type of the profile the extension is in.

Parameters

Returns

  • Promise<ProfileType>

    Pending

    This only returns a Promise when the callback parameter is not specified, and with MV3+. The type inside the Promise is the same as the 1st argument to callback.

getSessionState

chrome.loginState.getSessionState(
  callback?: function,
)
Promise

Gets the current session state.

Parameters

Returns

  • Promise<SessionState>

    Pending

    This only returns a Promise when the callback parameter is not specified, and with MV3+. The type inside the Promise is the same as the 1st argument to callback.

Events

onSessionStateChanged

chrome.loginState.onSessionStateChanged.addListener(
  callback: function,
)

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

Parameters