get Access Token
Get a short-lived OAuth access token for the user's account.
💾 This method alters the persisted account state.
Applications that need to access resources on behalf of the user must obtain an access_token
in order to do so. For example, an access token is required when fetching the user's profile data, or when accessing their data stored in Firefox Sync.
This method will obtain and return an access token bearing the requested scopes, either from a local cache of previously-issued tokens, or by creating a new one from the server.
Arguments
- `scope` - the OAuth scope to be granted by the token.
- This must be one of the scopes requested during the signin flow.
- Only a single scope is supported; for multiple scopes request multiple tokens.
- `ttl` - optionally, the time for which the token should be valid, in seconds.
Content copied to clipboard
Notes
- If the application receives an authorization error when trying to use the resulting
token, it should call [`clear_access_token_cache`](FirefoxAccount::clear_access_token_cache)
before requesting a fresh token.
Content copied to clipboard