diff --git a/mastodon/input.py b/mastodon/input.py --- a/mastodon/input.py +++ b/mastodon/input.py @@ -33,6 +33,7 @@ allowed_visibility: list[str] = field( default_factory=lambda: ALLOWED_VISIBILITY.copy() ) filters: list[re.Pattern[str]] = field(default_factory=lambda: []) + url_query_auth: bool = False @classmethod def from_dict(cls, data: dict[str, Any]) -> "MastodonInputOptions": @@ -55,6 +56,11 @@ self, db: DatabasePool, http: httpx.Client, options: MastodonInputOptions ) -> None: super().__init__(options.instance, db, http) self.options: MastodonInputOptions = options + + if options.url_query_auth: + self.log.warning( + "Using URL query auth! This is less secure than the default!" + ) self.log.info("Verifying '%s' credentails...", self.url) response = self.verify_credentials() @@ -249,7 +255,12 @@ @override async def listen(self): url = f"{self.streaming_url}/api/v1/streaming?stream=user" - headers = {"Authorization": f"Bearer {self.options.token}"} + headers = {} + + if not self.options.url_query_auth: + headers["Authorization"] = f"Bearer {self.options.token}" + else: + url += f"&access_token={self.options.token}" async for msg in listen_websocket(url, self.log, headers=headers): self.submitter(lambda: self._accept_msg(msg))