aiosfstream icon indicating copy to clipboard operation
aiosfstream copied to clipboard

[FEAT] Add support for JWT Authentication

Open emregunel opened this issue 3 years ago • 0 comments

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}")

emregunel avatar May 23 '22 19:05 emregunel