identity API
Hint
The identity API is inherited from Firefox, and its primary documentation is maintained by Mozilla at MDN. Thunderbird implements only the subset of functions, events, and types listed here. The MDN pages may provide further details and examples, but they may also reference features that are not supported in Thunderbird.
Use the chrome.identity API to get OAuth2 access tokens.
Permissions
The following permissions influence the behavior of the API. Depending on which permissions are requested, additional methods might be available, or certain data may be included in responses.
Hint
Request permissions only when needed. Unnecessary requests may result in rejection during ATN review.
identity
Grant access to some or all methods of the identity API.
Functions
getAccounts()
Retrieves a list of AccountInfo objects describing the accounts present on the profile.
Required permissions
getAuthToken([details])
Gets an OAuth2 access token using the client ID and scopes specified in the oauth2 section of manifest.json.
Parameters
details
account
interactive
scopes
Required permissions
getProfileUserInfo()
Retrieves email address and obfuscated gaia id of the user signed into a profile.
Required permissions
getRedirectURL([path])
– [Added in TB 53]
Generates a redirect URL to be used in launchWebAuthFlow(details).
Required permissions
launchWebAuthFlow(details)
– [Added in TB 53]
Starts an auth flow at the specified URL.
Parameters
details
Required permissions
removeCachedAuthToken(details)
Removes an OAuth2 access token from the Identity API’s token cache.
Required permissions
Events
onSignInChanged
Fired when signin state changes for an account on the user’s profile.
Parameters for onSignInChanged.addListener(listener)
listener(account, signedIn)
A function that will be called when this event occurs.
Parameters passed to the listener function
account
signedIn
Required permissions
Types
AccountInfo
An object encapsulating an OAuth account id.
object
id
A unique identifier for the account. This ID will not change for the lifetime of the account.
HttpURL
string