Welcome What's new in Chrome extensions API reference Samples
Welcome What's new in Chrome extensions API reference Samples

chrome.loginState

Important: This API works only on ChromeOS
  • Description

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

  • Permissions
    loginState
  • Availability
    Chrome 78+ ChromeOS only

Summary

Types

ProfileType

Enum

"SIGNIN_PROFILE"
Specifies that the extension is in the signin profile.

"USER_PROFILE"
Specifies that the extension is in the user profile.

SessionState

Enum

"UNKNOWN"
Specifies that the session state is unknown.

"IN_OOBE_SCREEN"
Specifies that the user is in the out-of-box-experience screen.

"IN_LOGIN_SCREEN"
Specifies that the user is in the login screen.

"IN_SESSION"
Specifies that the user is in the session.

"IN_LOCK_SCREEN"
Specifies that the user is in the lock screen.

"IN_RMA_SCREEN"
Specifies that the device is in RMA mode, finalizing repairs.

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

This site uses cookies to deliver and enhance the quality of its services and to analyze traffic. If you agree, cookies are also used to serve advertising and to personalize the content and advertisements that you see. Learn more about our use of cookies.