mirror of
https://github.com/jellyfin/jellyfin-sdk-typescript.git
synced 2024-11-23 14:09:43 +00:00
Merge pull request #564 from zachwn/headerEncoding
This commit is contained in:
commit
96f6d0262b
@ -9,12 +9,11 @@ import type { ClientInfo, DeviceInfo } from '../models';
|
||||
* Returns a valid authorization header string.
|
||||
*/
|
||||
export function getAuthorizationHeader(clientInfo: ClientInfo, deviceInfo: DeviceInfo, accessToken = ''): string {
|
||||
// TODO: We should ensure values are properly escaped
|
||||
return [
|
||||
`MediaBrowser Client="${clientInfo.name}"`,
|
||||
`Device="${deviceInfo.name}"`,
|
||||
`DeviceId="${deviceInfo.id}"`,
|
||||
`Version="${clientInfo.version}"`,
|
||||
`Token="${accessToken}"`
|
||||
`MediaBrowser Client="${encodeURIComponent(clientInfo.name)}"`,
|
||||
`Device="${encodeURIComponent(deviceInfo.name)}"`,
|
||||
`DeviceId="${encodeURIComponent(deviceInfo.id)}"`,
|
||||
`Version="${encodeURIComponent(clientInfo.version)}"`,
|
||||
`Token="${encodeURIComponent(accessToken)}"`
|
||||
].join(', ');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user