philippe44 / LMS-Raop

LMS to AirPlay bridge
68 stars 13 forks source link

Pairing not possible: '400 Bad Request' #29

Closed chincheta0815 closed 2 years ago

chincheta0815 commented 2 years ago

Hi philippe44,

I think it makes sense to add this isse here for completeness. It also in the forum: https://forums.slimdevices.com/showthread.php?105198-ANNOUNCE-AirPlay-Bridge-integrate-AirPlay-devices-with-LMS-(squeeze2raop)&p=1060984&viewfull=1#post1060984

I am trying to pair my AirPlay Bridge and get '400 Bad Request' in the LogFiles and do not know if it's me or the system(s) which are doing wrong.

Systems:

How to reproduce:

  1. Clean, bew install of the AirPlay Bridge.
  2. Wait unit the AppleTV is discovered.
  3. Click the 'Pair' Button.
  4. NO Pin is shown on the AppleTV.

Result: The LMS GUI show the 'Enter OIN Code' Message and I can enter something. The log of LMS show:

[22-09-13 05:39:10.0294] main::init (377) Starting Logitech Media Server (v8.3.0, b28d5a6.raspi, Mon 12 Sep 13:20:46 CEST 2022) perl 5.032001 - aarch64-linux-gnu-thread-multi
[22-09-13 05:43:28.8760] Plugins::RaopBridge::Pairing::__ANON__ (67) $VAR1 = bless( [
                 undef,
                 undef,
                 bless( {
                          '_method' => 'POST',
                          '_uri' => bless( do{\(my $o = 'http://192.168.47.202:7000/pair-pin-start')}, 'URI::http' ),
                          '_protocol' => 'HTTP/1.0',
                          '_content' => '',
                          '_headers' => bless( {
                                                 'host' => '192.168.47.202:7000',
                                                 'content-type' => 'application/octet-stream',
                                                 'icy-metadata' => 1,
                                                 'cache-control' => 'no-cache',
                                                 'user-agent' => 'iTunes/4.7.1 (Linux; N; Debian; aarch64-linux; DE; utf8) SqueezeCenter, Squeezebox Server, Logitech Media Server/8.3.0/b28d5a6.raspi',
                                                 'connection' => 'Keep-Alive',
                                                 '::std_case' => {
                                                                   'icy-metadata' => 'Icy-Metadata'
                                                                 },
                                                 'accept' => '*/*'
                                               }, 'HTTP::Headers' )
                        }, 'HTTP::Request' ),
                 bless( {
                          '_msg' => 'Bad Request',
                          '_content' => '',
                          '_headers' => bless( {
                                                 'server' => 'AirTunes/635.87.3',
                                                 'content-length' => '0',
                                                 '::std_case' => {
                                                                   'set-cookie2' => 'Set-Cookie2',
                                                                   'set-cookie' => 'Set-Cookie'
                                                                 }
                                               }, 'HTTP::Headers' ),
                          '_rc' => '400',
                          '_request' => $VAR1->[2],
                          '_previous' => []
                        }, 'HTTP::Response' ),
                 undef,
                 undef,
                 undef,
                 7
               ], 'Plugins::RaopBridge::Async::HTTP' );
$VAR2 = '400 Bad Request';
[22-09-13 05:43:28.8764] Plugins::RaopBridge::Pairing::__ANON__ (67) Display PIN error

All I did is starting up LMS without any special IP related command line args.

chincheta0815 commented 2 years ago

As I wrote on the forum (https://forums.slimdevices.com/showthread.php?105198-ANNOUNCE-AirPlay-Bridge-integrate-AirPlay-devices-with-LMS-(squeeze2raop)&p=1061031&viewfull=1#post1061031) I got that solved.

The issue was that I set the Airplay & HomeKit settings in the AppleTV to "Users in the same Home". This seems to do a kind of authentication and also seems to be kind of a new feature (probably standard feature in the future?).

I found a library that deals with all the authentication stuff. For completeness and probably future lookups, here is the link: https://github.com/postlund/pyatv