Skip to content

Commit

Permalink
Update authorization logic to include ton.space bridge in addition …
Browse files Browse the repository at this point in the history
…to `tonapi`.
  • Loading branch information
nessshon committed Jul 16, 2024
1 parent 74f1b75 commit 133c902
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aiogram_tonconnect/tonconnect/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def send(self, request: str, receiver_public_key: str, topic: str, ttl: in
bridge_url += f'&topic={topic}'
headers = {'Content-type': 'text/plain;charset=UTF-8'}

if "tonapi" in bridge_base and self.tonapi_token:
if self.tonapi_token and "tonapi" in bridge_base or "ton.space" in bridge_base:
headers["Authorization"] = f"Bearer {self.tonapi_token}"

async with ClientSession(headers=headers) as session:
Expand All @@ -61,7 +61,7 @@ async def register_session(self) -> bool:
resolve = loop.create_future()

session = ClientSession()
if "tonapi" in bridge_base and self.tonapi_token:
if self.tonapi_token and "tonapi" in bridge_base or "ton.space" in bridge_base:
headers = {"Authorization": f"Bearer {self.tonapi_token}"}
session.headers.update(headers)

Expand Down

0 comments on commit 133c902

Please sign in to comment.