欢迎 What's new in Chrome extensions Get help with Chrome extensions API reference Samples
欢迎 What's new in Chrome extensions Get help with Chrome extensions 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>

    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,
)
Promise

Gets the current session state.

Parameters

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

We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.