code: async def auth(self):
          
          credentials = await self.atv.airplay.generate_credentials()
          await self.atv.airplay.load_credentials(credentials)
  
          try:
              await self.atv.airplay.start_authentication()
              pin = await _read_input(self.loop, 'Enter PIN on screen: ')
  
              await self.atv.airplay.finish_authentication(pin)
              print('You may now use these credentials:')
              print(credentials)
              return 0
  
          except exceptions.DeviceAuthenticationError:
              logging.exception('Failed to authenticate - invalid PIN?')
              return 1
docs: Perform AirPlay device authentication.