Last active
June 3, 2025 14:50
-
-
Save sbogomolov/708eba479c61b0bc0ada18aad5b2c544 to your computer and use it in GitHub Desktop.
Property Mapping for authentik: Overseerr authentication using Plex SSO token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from authentik.sources.plex.models import UserPlexSourceConnection | |
import json | |
connection = UserPlexSourceConnection.objects.filter(user=request.user).first() | |
if not connection: | |
ak_logger.info("Overseer: No Plex connection found") | |
return {} | |
base_url = "http://overseerr.apps:5055" | |
end_point = "/api/v1/auth/plex" | |
headers = { | |
"Content-Type": "application/json", | |
} | |
data = { | |
"authToken": connection.plex_token | |
} | |
response = requests.post(base_url + end_point, headers=headers, data=json.dumps(data)) | |
if response.status_code == 200: | |
sid_value = response.cookies.get("connect.sid") | |
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 {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You’re most welcome.