identity API
Use the chrome.identity API to get OAuth2 access tokens.
Permissions
Functions
getAccounts()
Retrieves a list of AccountInfo objects describing the accounts present on the profile.
Return type (Promise)
array of AccountInfo
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
]
(object, optional)
[interactive
]
(boolean, optional)
[scopes
]
(array of string, optional)
Return type (Promise)
array of AccountInfo
Required permissions
getProfileUserInfo()
Retrieves email address and obfuscated gaia id of the user signed into a profile.
Return type (Promise)
object
email
(string)
id
(string)
Required permissions
getRedirectURL([path])
Generates a redirect URL to be used in |launchWebAuthFlow|.
Parameters
[path
]
(string, optional)
The path appended to the end of the generated URL.
Return type (Promise)
string
Required permissions
launchWebAuthFlow(details)
Starts an auth flow at the specified URL.
Parameters
details
(object)
url
(identity.HttpURL)
[interactive
]
(boolean, optional)
Return type (Promise)
string
Required permissions
removeCachedAuthToken(details)
Removes an OAuth2 access token from the Identity API’s token cache.
Parameters
details
(object)
token
(string)
Return type (Promise)
object
email
(string)
id
(string)
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.
Required permissions
Types
AccountInfo
An object encapsulating an OAuth account id.
object
id
(string)
A unique identifier for the account. This ID will not change for the lifetime of the account.