Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

SyncPlay api authentication problems #6

Open
DavidM42 opened this issue Mar 11, 2021 · 0 comments
Open

SyncPlay api authentication problems #6

DavidM42 opened this issue Mar 11, 2021 · 0 comments

Comments

@DavidM42
Copy link

I am having a hard time trying to use this project to retrieve data about SyncPlay sessions and eventually manipulate them. Since there is no real documentation yet I am trying to figure it out myself.
The given "examples" jellyfin-vue and chromecast sadly don't help me since I can't find the authentication part of this library in them. If it is in there I'd appreciate to be pointed towards that.

What I am trying to achieve at the moment is getting a list of all active SyncPlay sessions. A simplified version of my code is as follows

import {
  SyncPlayApi,
  Configuration,
  ConfigurationParameters,
  SystemApi
} from '@jellyfin/client-axios';

import { AxiosError } from 'axios';

const configParameters: ConfigurationParameters = {
  // this get's send to Jellyfin as Emby Authorization header but does not have access to sync api it seems
  apiKey: 'XXXXXXXXXbfXXXXXXXXXXXX',

  // as far as I can see from the AxiosError returned these get not included in any form in the request
  // username: 'XXXX',
  // password: 'XXXX;',

  // copied out of web client storage for now
  // the error message in the jellyfin logs demands this kind of authentication
  // but same as username is does not seem to be included -> in contrast to the api key
  // accessToken: 'XXXXXXXXXX', 
  
  basePath: 'https://jellyfin.example.com'
};

configuration = new Configuration(configParameters);

const syncApi = new SyncPlayApi(this.configuration);
try {
  const result = (await syncApi.syncPlayGetGroups()).data[0].GroupId;
  return result;
} catch(e) {
  const typedE = e as AxiosError;
  console.log(typedE.response);
  return 'errored';
}

I have checked the jellyfin logs and there is this message

Error processing request: "Access token is required". URL: "http://jellyfin.example.com/SyncPlay/List"
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant