Skip to content

Instantly share code, notes, and snippets.

@sbogomolov
Last active October 31, 2025 15:20
Show Gist options
  • Select an option

  • Save sbogomolov/708eba479c61b0bc0ada18aad5b2c544 to your computer and use it in GitHub Desktop.

Select an option

Save sbogomolov/708eba479c61b0bc0ada18aad5b2c544 to your computer and use it in GitHub Desktop.
Property Mapping for authentik: Overseerr authentication using Plex SSO token
import json
import requests
from authentik.sources.plex.models import UserPlexSourceConnection
connection = UserPlexSourceConnection.objects.filter(user=request.user).first()
if not connection:
ak_logger.info("Overseer: No Plex connection found")
return {}
base_url = "http://overseerr:5055"
end_point = "/api/v1/auth/plex"
headers = {
"Content-Type": "application/json",
}
data = {
"authToken": connection.plex_token
}
try:
response = requests.post(base_url + end_point, headers=headers, data=json.dumps(data), timeout=5)
if response.status_code == 200:
sid_value = response.cookies.get("connect.sid")
if not sid_value:
ak_logger.error("Overseer: connect.sid cookie not present in response")
return {}
cookie_obj = f"connect.sid={sid_value}"
ak_logger.info("Overseer: Successfully authenticated with Plex token")
return {
"ak_proxy": {
"user_attributes": {
"additionalHeaders": {
"Cookie": cookie_obj
}
}
}
}
else:
ak_logger.error(f"Overseer: The request failed with: {response.text}")
return {}
except requests.Timeout:
ak_logger.error("Overseer: Request to Overseerr timed out")
return {}
except requests.RequestException as e:
ak_logger.error(f"Overseer: Request exception: {e}")
return {}
except Exception as e:
ak_logger.error(f"Overseer: Unexpected error: {e}")
return {}
@RemiEthereal
Copy link

Hm. Where do you see the error about it being missing? Try the whoami image and verify which headers are being passed. Even though it’s called Cookie, it’s actually a header :)

You telling me it's actually a header saved the day ^^

@sbogomolov
Copy link
Author

Great that it works for you!

@RemiEthereal
Copy link

Did anyone else have any issues after upgrading to Authentik version 2025.10.0? This doesn't seem to work at all anymore.

@lmaced0
Copy link

lmaced0 commented Oct 30, 2025

Did anyone else have any issues after upgrading to Authentik version 2025.10.0? This doesn't seem to work at all anymore.

Good to know. Holding off on the upgrade.

@sbogomolov
Copy link
Author

I have stopped using this some time ago (switched to Jellyseerr). If you figure out what's wrong - let me know and I'll update the snippet.

@RemiEthereal
Copy link

I have stopped using this some time ago (switched to Jellyseerr). If you figure out what's wrong - let me know and I'll update the snippet.

Does jellyseerr have better support for SSO or why did you end up not using this anymore?

@sbogomolov
Copy link
Author

sbogomolov commented Oct 31, 2025

Does jellyseerr have better support for SSO or why did you end up not using this anymore?

It does. There is a PR (not yet merged) that adds a proper OIDC support. Even though it is not merged - the preview image built with it works just fine.

The image in question:

docker.io/fallenbagel/jellyseerr:preview-OIDC

P.S. I’ve also moved away from Plex to Jellyfin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment