Unauthorized (HTTP/1.1 401 Unauthorized) for Streaming Socket Android App #234
-
Which Deepgram product are you using?Deepgram API DetailsI am trying to do live transcription in the context of an android app and below I have included a code snippet of my logic where I use deepgram. If you are making a request to the Deepgram API, what is the full Deepgram URL you are making a request to?"wss://api.deepgram.com/v1/listen?model=nova&version=latest&punctuate=true&numerals=true&smart_format=true&interim_results=false&token=**********" If you are making a request to the Deepgram API and have a request ID, please paste it below:No response If possible, please attach your code or paste it into the text box.import android.Manifest class TranscriptionClient(private val context: Context) {
} If possible, please attach an example audio file to reproduce the issue.No response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 14 replies
-
Hey @mhmohebbi this should be a quick fix. Rather than putting the token in the URL as a query parameter, the token should be set as a header in the websocket connection. I don't know how to set headers for websocket tokens in Kotlin, but the key/value should be: |
Beta Was this translation helpful? Give feedback.
I looked at those requests, and they seemed to process fine - if there is no transcript, it is either because there was no speech, or, more likely, because the audio format is not set correctly - are you specifying
encoding=linear16&sample_rate=44100
? And if so, are you sure this is correct? (Looking at the code, this is what it appears to be, but it is possible it isn't - the best way to validate that we suggest is here: https://github.com/deepgram/streaming-test-suite/tree/main#validate-your-audio).