mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-10 10:56:28 +00:00
Use update, reload and abort helper in reauth documentation (#2083)
This commit is contained in:
parent
8ba4e02fad
commit
47042ac3de
@ -303,12 +303,14 @@ class OAuth2FlowHandler(
|
|||||||
|
|
||||||
async def async_oauth_create_entry(self, data: dict) -> dict:
|
async def async_oauth_create_entry(self, data: dict) -> dict:
|
||||||
"""Create an oauth config entry or update existing entry for reauth."""
|
"""Create an oauth config entry or update existing entry for reauth."""
|
||||||
if self._reauth_entry:
|
if self.reauth_entry:
|
||||||
self.hass.config_entries.async_update_entry(self.reauth_entry, data=data)
|
return self.async_update_reload_and_abort(
|
||||||
await self.hass.config_entries.async_reload(self.reauth_entry.entry_id)
|
self.reauth_entry,
|
||||||
return self.async_abort(reason="reauth_successful")
|
data=data,
|
||||||
|
)
|
||||||
return await super().async_oauth_create_entry(data)
|
return await super().async_oauth_create_entry(data)
|
||||||
```
|
```
|
||||||
|
By default, the `async_update_reload_and_abort` helper method aborts the flow with `reauth_successful` after update and reload.
|
||||||
|
|
||||||
Depending on the details of the integration, there may be additional considerations such as ensuring the same account is used across reauth, or handling multiple config entries.
|
Depending on the details of the integration, there may be additional considerations such as ensuring the same account is used across reauth, or handling multiple config entries.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user