Recognition failed with Canceled. Did you enter your subscription? WebSocket Upgrade failed with an authentication error (401). Please check the subscription key or the authorization token, and the region name.
See original GitHub issueI pulled down this repo and built it in Android Studio
When I hit the recognize button I get this error:
“Recognition failed with Canceled. Did you enter your subscription? WebSocket Upgrade failed with an authentication error (401). Please check the subscription key or the authorization token, and the region name.”
I was able to verify my subscription key as valid by using powershell to test a post (see below) $FetchTokenHeader = @{ ‘Content-type’=‘application/x-www-form-urlencoded’ ‘Content-Length’= ‘0’ ‘Ocp-Apim-Subscription-Key’ = ‘my key here’ } $OAuthToken = Invoke-RestMethod -Method POST -Uri https://api.cognitive.microsoft.com/sts/v1.0/issueToken -Headers $FetchTokenHeader $OAuthToken
The test was successful and I got an auth token. So I know that is correct.
But I could not find what region my resource was in, It just said global.
I tried every one of regions, including the global listed in the azure website to no avail.
1.) How do I definitively determine the region of my azure bing resource? 2.) Why can I not get around this error with a valid subscription key and the valid region? I tested all regions, one of them had to be correct.
FYI - Once I can get the reco working on this, I will be porting this code to Xamarin.
That usually means doing a binding library for the .aar and referencing it that way.
Please advise if this is the easiest path. It seems that the NuGet package out there was geared to C# and not necc Xamarin.
This issue is for a: (mark with an x
)
- [X ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
Minimal steps to reproduce
Build and deploy to a samsung S2 tablet click the recognize button view error
Any log messages given by the failure
09-19 15:38:24.108 27054-27054/? E/Zygote: v2 09-19 15:38:24.109 27054-27054/? I/libpersona: KNOX_SDCARD checking this for 10519 KNOX_SDCARD not a persona 09-19 15:38:24.109 27054-27054/? E/Zygote: accessInfo : 0 09-19 15:38:24.110 27054-27054/? W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2], Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0010, [-1 -1 -1 -1 0 1] 09-19 15:38:24.111 27054-27054/? I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.microsoft.cognitiveservices.speech.samples.sdkdemo 09-19 15:38:24.113 27054-27054/? I/art: Late-enabling -Xcheck:jni 09-19 15:38:24.149 27054-27054/? D/TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service 09-19 15:38:24.277 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo I/InstantRun: starting instant run server: is main process 09-19 15:38:24.341 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 09-19 15:38:24.412 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/TextView: setTypeface with style : 0 09-19 15:38:24.413 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/TextView: setTypeface with style : 0 09-19 15:38:24.441 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/TextView: setTypeface with style : 0 09-19 15:38:24.444 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/TextView: setTypeface with style : 0 09-19 15:38:24.446 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/TextView: setTypeface with style : 0 09-19 15:38:24.447 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/TextView: setTypeface with style : 0 09-19 15:38:24.449 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/TextView: setTypeface with style : 0 09-19 15:38:24.531 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/ViewRootImpl@8692e94[MainActivity]: ThreadedRenderer.create() translucent=false 09-19 15:38:24.536 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/InputTransport: Input channel constructed: fd=76 09-19 15:38:24.536 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/ViewRootImpl@8692e94[MainActivity]: setView = DecorView@b721d3d[MainActivity] touchMode=true 09-19 15:38:24.558 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/ViewRootImpl@8692e94[MainActivity]: dispatchAttachedToWindow 09-19 15:38:24.605 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/ViewRootImpl@8692e94[MainActivity]: Relayout returned: oldFrame=[0,0][0,0] newFrame=[0,0][1536,2048] result=0x27 surface={isValid=true 547617089024} surfaceGenerationChanged=true mHardwareRenderer.initialize() mSurface={isValid=true 547617089024} hwInitialized=true 09-19 15:38:24.605 27054-27072/com.microsoft.cognitiveservices.speech.samples.sdkdemo I/Adreno: QUALCOMM build : e488ad0, Ie9c95840c4 Build Date : 10/11/17 OpenGL ES Shader Compiler Version: XE031.09.00.03 Local Branch : Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.BR.1.3.6.C1_RB1.07.00.00.267.008 Remote Branch : NONE Reconstruct Branch : NOTHING 09-19 15:38:24.610 27054-27072/com.microsoft.cognitiveservices.speech.samples.sdkdemo I/OpenGLRenderer: Initialized EGL, version 1.4 09-19 15:38:24.610 27054-27072/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/OpenGLRenderer: Swap behavior 1 09-19 15:38:24.635 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView 09-19 15:38:24.659 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/ViewRootImpl@8692e94[MainActivity]: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 1536, 2048) ci=Rect(0, 48 - 0, 0) vi=Rect(0, 48 - 0, 0) or=1 MSG_WINDOW_FOCUS_CHANGED 1 mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true 547617089024} 09-19 15:38:24.660 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@8224765 nm : com.microsoft.cognitiveservices.speech.samples.sdkdemo ic=null 09-19 15:38:24.660 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus 09-19 15:38:24.668 27054-27068/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/InputTransport: Input channel constructed: fd=79 09-19 15:38:24.681 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/ViewRootImpl@8692e94[MainActivity]: Relayout returned: oldFrame=[0,0][1536,2048] newFrame=[0,0][1536,2048] result=0x1 surface={isValid=true 547617089024} surfaceGenerationChanged=false 09-19 15:38:24.687 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@5775c3a nm : com.microsoft.cognitiveservices.speech.samples.sdkdemo ic=null 09-19 15:38:29.008 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/ViewRootImpl@8692e94[MainActivity]: ViewPostImeInputStage processPointer 0 09-19 15:38:29.015 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo V/BoostFramework: mAcquireFunc method = public int com.qualcomm.qti.Performance.perfLockAcquire(int,int[]) mReleaseFunc method = public int com.qualcomm.qti.Performance.perfLockRelease() mAcquireTouchFunc method = public int com.qualcomm.qti.Performance.perfLockAcquireTouch(android.view.MotionEvent,android.util.DisplayMetrics,int,int[]) mIOPStart method = public int com.qualcomm.qti.Performance.perfIOPrefetchStart(int,java.lang.String) mIOPStop method = public int com.qualcomm.qti.Performance.perfIOPrefetchStop() 09-19 15:38:29.020 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@36786f4 09-19 15:38:29.107 27054-27054/com.microsoft.cognitiveservices.speech.samples.sdkdemo D/ViewRootImpl@8692e94[MainActivity]: ViewPostImeInputStage processPointer 1 09-19 15:38:30.401 27054-27080/com.microsoft.cognitiveservices.speech.samples.sdkdemo I/reco 1: Recognizer returned: Recognition failed with Canceled. Did you enter your subscription? WebSocket Upgrade failed with an authentication error (401). Please check the subscription key or the authorization token, and the region name.
Expected/desired behavior
speech to text recognition would occur
OS and Version?
Windows 10 running Android Studio 3.1.4 => deploying to Samsung T713 S2 tablet running Android 7.0
Versions
Mention any other details that might be useful
Thanks! We’ll be in touch soon.
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (6 by maintainers)
Top GitHub Comments
@sabuncu - Just a quick way to try multiple endpoints without running code (and it prettifies the response and response headers). I validated in Python as well.
@sabuncu - I just ran a test using a F0 resource in West Europe. It looks like you’ll need to preface
.api.cognitive
with your region.We’ll do a quick pass on the docs to make sure that this is more clear.