aiosfstream
aiosfstream copied to clipboard
[FEAT] Add support for JWT Authentication
JWT Authentication is a common scenario for Server to server applications.
It will be nice to have this supported built-in, otherwise developers will need to do it in their application.
Below should be possible after this implementation:
from aiosfstream.auth import JWTAuthenticator
from aiosfstream import Client
authenticator = JWTAuthenticator(consumer_key=",
username="",
private_key="")
async def stream_events():
async with Client(authenticator) as client:
await client.subscribe("/topic/1")
async for message in client:
topic = message["channel"]
data = message["data"]
print(f"{topic}: {data}")