#Authentication for streaming audio direct from client: what is the "right" (secure & supported) way?

1 messages · Page 1 of 1 (latest)

tropic oar
#

My question "contained content blocked by the servers" (to many links to Deepgram github?. Worried I'll need to wait another 6hrs to poast again if it gets blocked again, so I have added detail as an attached image.

onyx torrentBOT
#

Thanks for asking your question. Please be sure to reply with as much detail as possible so the community can assist you efficiently.
-# If you haven't done so, ensure your Discord and Github profiles are linked to Deepgram so you can earn points to redeem on cool stuff just by being active!

#

It looks like we're missing some important information to help debug your issue. Would you mind providing us with the following details in a reply?

  • The programming language you are working in (e.g. JavaScript, Python).
  • A request ID that triggered your error or issue.
tropic oar
#

Javascript and Python. No request ID - this is an architecture question. Details in the attached image.

heady scroll
#

Nah deepgram's docs are trash when it comes to this, you gotta use their tokens api (on js deepgramClient.auth.grantToken()). This token needs to be sent as a "Bearer {your token here}" instead of a "Token {your token here}", which is only for API keys

tropic oar
#

Thank Luca. Yeah temp JWT is what I ended up using

Server:

from deepgram.clients.auth.v1.client import AuthRESTClient
from deepgram.client import DeepgramClientOptions

deepgram_client_config = DeepgramClientOptions(api_key=os.getenv("DEEPGRAM_API_KEY"))
result = deepgram_auth_client.grant_token()
access_token = result.access_token

And client (vanilla js to skip loading the script from the CDN which seems a bit like overkill):

const socket = new WebSocket(
  `wss://api.deepgram.com/v1/listen?model=nova&smart_format=true`,
  ["token", "TOKEN"]
);