diff --git a/src/screens/modals/SetJellyfinServer/components/CredentialGenerator.tsx b/src/screens/modals/SetJellyfinServer/components/CredentialGenerator.tsx index 4b4e44b..fde6bfe 100644 --- a/src/screens/modals/SetJellyfinServer/components/CredentialGenerator.tsx +++ b/src/screens/modals/SetJellyfinServer/components/CredentialGenerator.tsx @@ -122,7 +122,7 @@ const CredentialGenerator: React.FC = ({ serverUrl, onCredentialsRetrieve // good const response = await fetch(`${address}/Users/${userId}`, { headers: { - 'X-Emby-Authorization': `MediaBrowser Client="", Device="", DeviceId="", Version="", Token="${accessToken}"` + 'Authorization': `MediaBrowser Client="", Device="", DeviceId="", Version="", Token="${accessToken}"` } }); diff --git a/src/utility/JellyfinApi/lib.ts b/src/utility/JellyfinApi/lib.ts index f0c0e7a..8ee6139 100644 --- a/src/utility/JellyfinApi/lib.ts +++ b/src/utility/JellyfinApi/lib.ts @@ -20,11 +20,22 @@ const deviceMap: Record = { * Jellyfin server. */ function generateConfig(credentials: Credentials): RequestInit { - return { - headers: { - 'X-Emby-Authorization': `MediaBrowser Client="Fintunes", Device="${deviceMap[Platform.OS]}", DeviceId="${credentials?.device_id}", Version="${version}", Token="${credentials?.access_token}"` - } - }; + switch (credentials?.type) { + case 'jellyfin': + return { + headers: { + 'Authorization': `MediaBrowser Client="Fintunes", Device="${deviceMap[Platform.OS]}", DeviceId="${credentials?.device_id}", Version="${version}", Token="${credentials?.access_token}"` + } + }; + case 'emby': + return { + headers: { + 'X-Emby-Authorization': `MediaBrowser Client="Fintunes", Device="${deviceMap[Platform.OS]}", DeviceId="${credentials?.device_id}", Version="${version}", Token="${credentials?.access_token}"` + } + }; + default: + return {}; + } } /**