Fix Plex auth issues by setting header (#43081)
parent
9d617d446e
commit
176c2f3978
|
@ -289,6 +289,8 @@ class PlexFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
async def async_step_plex_website_auth(self):
|
||||
"""Begin external auth flow on Plex website."""
|
||||
self.hass.http.register_view(PlexAuthorizationCallbackView)
|
||||
hass_url = get_url(self.hass)
|
||||
headers = {"Origin": hass_url}
|
||||
payload = {
|
||||
"X-Plex-Device-Name": X_PLEX_DEVICE_NAME,
|
||||
"X-Plex-Version": X_PLEX_VERSION,
|
||||
|
@ -298,9 +300,9 @@ class PlexFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
"X-Plex-Model": "Plex OAuth",
|
||||
}
|
||||
session = async_get_clientsession(self.hass)
|
||||
self.plexauth = PlexAuth(payload, session)
|
||||
self.plexauth = PlexAuth(payload, session, headers)
|
||||
await self.plexauth.initiate_auth()
|
||||
forward_url = f"{get_url(self.hass)}{AUTH_CALLBACK_PATH}?flow_id={self.flow_id}"
|
||||
forward_url = f"{hass_url}{AUTH_CALLBACK_PATH}?flow_id={self.flow_id}"
|
||||
auth_url = self.plexauth.auth_url(forward_url)
|
||||
return self.async_external_step(step_id="obtain_token", url=auth_url)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"documentation": "https://www.home-assistant.io/integrations/plex",
|
||||
"requirements": [
|
||||
"plexapi==4.1.1",
|
||||
"plexauth==0.0.5",
|
||||
"plexauth==0.0.6",
|
||||
"plexwebsocket==0.0.12"
|
||||
],
|
||||
"dependencies": ["http"],
|
||||
|
|
|
@ -1124,7 +1124,7 @@ pizzapi==0.0.3
|
|||
plexapi==4.1.1
|
||||
|
||||
# homeassistant.components.plex
|
||||
plexauth==0.0.5
|
||||
plexauth==0.0.6
|
||||
|
||||
# homeassistant.components.plex
|
||||
plexwebsocket==0.0.12
|
||||
|
|
|
@ -541,7 +541,7 @@ pillow==7.2.0
|
|||
plexapi==4.1.1
|
||||
|
||||
# homeassistant.components.plex
|
||||
plexauth==0.0.5
|
||||
plexauth==0.0.6
|
||||
|
||||
# homeassistant.components.plex
|
||||
plexwebsocket==0.0.12
|
||||
|
|
Loading…
Reference in New Issue