mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-16 13:56:29 +00:00
Document 'force' in external_auth (#387)
This commit is contained in:
parent
3c61ad3c81
commit
732ee0523b
@ -12,15 +12,19 @@ To activate this API, load the frontend with `?external_auth=1` appended to the
|
||||
|
||||
_This API has been introduced in Home Assistant 0.78._
|
||||
|
||||
When the frontend loads, it will request an access token from the external authentication. It does so by calling one of the following methods with an options object. The options object defines the callback method to be called with the response.
|
||||
When the frontend loads, it will request an access token from the external authentication. It does so by calling one of the following methods with an options object. The options object defines the callback method to be called with the response and an optional `force` boolean which is set to `true` if the access token should be refreshed, regardless if it has expired or not.
|
||||
|
||||
The `force` boolean has been introduced in Home Assistant 0.104 and might not always be available.
|
||||
|
||||
```js
|
||||
window.externalApp.getExternalAuth({
|
||||
callback: 'externalAuthSetToken'
|
||||
callback: "externalAuthSetToken",
|
||||
force: true
|
||||
});
|
||||
// or
|
||||
window.webkit.messageHandlers.getExternalAuth.postMessage({
|
||||
callback: 'externalAuthSetToken'
|
||||
callback: "externalAuthSetToken",
|
||||
force: true
|
||||
});
|
||||
```
|
||||
|
||||
@ -29,8 +33,8 @@ The response should contain a boolean if it was successful and an object contain
|
||||
```js
|
||||
// To be called by external app
|
||||
window.externalAuthSetToken(true, {
|
||||
"access_token": "qwere",
|
||||
"expires_in": 1800
|
||||
access_token: "qwere",
|
||||
expires_in: 1800
|
||||
});
|
||||
|
||||
// If unable to get new access token
|
||||
@ -47,11 +51,11 @@ When the user presses the logout button on the profile page, the external app wi
|
||||
|
||||
```js
|
||||
window.externalApp.revokeExternalAuth({
|
||||
callback: 'externalAuthRevokeToken'
|
||||
callback: "externalAuthRevokeToken"
|
||||
});
|
||||
// or
|
||||
window.webkit.messageHandlers.revokeExternalAuth.postMessage({
|
||||
callback: 'externalAuthRevokeToken'
|
||||
callback: "externalAuthRevokeToken"
|
||||
});
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user