awslabs / amazon-kinesis-video-streams-webrtc-sdk-android

Android SDK for interfacing with Amazon Kinesis Video Streams Signaling Service.
Apache License 2.0
58 stars 37 forks source link

Create client failed with Failed to get credentials from Cognito Identiy #73

Closed Sleepingbug closed 2 years ago

Sleepingbug commented 2 years ago

no matter what i do, START MASTER or START VIEWER, the result is always "Create client failed with Failed to get credentials from Cognito Identiy"

I followed the steps mentioned here https://docs.aws.amazon.com/kinesisvideostreams-webrtc-dg/latest/devguide/kvswebrtc-getting-started.html

I get my User Pool ID : us-east-2_lq**9 App client id : vj...jk App client secret:1h......1

and "Get AWS Credentials" : // Initialize the Amazon Cognito credentials provider CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider( getApplicationContext(), "us-east-2:75xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx41", // Identity pool ID Regions.US_EAST_2 // Region );

So my configuration is as follows: { "Version": "1.0", "CredentialsProvider": { "CognitoIdentity": { "Default": { "PoolId": "us-east-2_lq****9", "Region": "us-east-2" } } }, "IdentityManager": { "Default": {} }, "CognitoUserPool": { "Default": { "AppClientSecret": "1h......1", "AppClientId": "vj...jk", "PoolId": "us-east-2:75xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx41", "Region": "us-east-2" } } }**

but when i run the app and click "START MASTER" or "START VIEW", a dialog box prompting "Create client failed with Failed to get credentials from Cognito Identiy" appears.

I am confused and don't know what went wrong

Sleepingbug commented 2 years ago

This is the log after I click "START MASTER",I believe it’s not a network problem, because I can log in

2021-12-09 17:04:24.664 23632-23632/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 V/AudioManager: querySoundEffectsEnabled... 2021-12-09 17:04:24.670 23632-23651/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 I/AndroidSecurityKeyStore: keystore characteristics promise future onFinished. 2021-12-09 17:04:24.674 23632-23651/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 I/AndroidSecurityKeyStore: keystore characteristics promise future onFinished. 2021-12-09 17:04:24.677 23632-23651/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 I/AndroidSecurityKeyStore: keystore characteristics promise future onFinished. 2021-12-09 17:04:24.680 23632-23680/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 I/AndroidSecurityKeyStore: keystore characteristics promise future onFinished. 2021-12-09 17:04:24.680 23632-23882/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 D/AWSMobileClient: Inspecting user state details 2021-12-09 17:04:24.683 23632-23882/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 W/AWSMobileClient: Could not check if ACCESS_NETWORK_STATE permission is available. java.lang.ClassNotFoundException: android.support.v4.content.ContextCompat at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:454) at java.lang.Class.forName(Class.java:379) at com.amazonaws.mobile.client.AWSMobileClient.isNetworkAvailable(AWSMobileClient.java:751) at com.amazonaws.mobile.client.AWSMobileClient.getUserStateDetails(AWSMobileClient.java:963) at com.amazonaws.mobile.client.AWSMobileClient.waitForSignIn(AWSMobileClient.java:903) at com.amazonaws.mobile.client.AWSMobileClient.getCredentials(AWSMobileClient.java:355) at com.amazonaws.kinesisvideo.demoapp.fragment.StreamWebRtcConfigurationFragment.getAwsKinesisVideoClient(StreamWebRtcConfigurationFragment.java:272) at com.amazonaws.kinesisvideo.demoapp.fragment.StreamWebRtcConfigurationFragment.access$300(StreamWebRtcConfigurationFragment.java:53) at com.amazonaws.kinesisvideo.demoapp.fragment.StreamWebRtcConfigurationFragment$UpdateSignalingChannelInfoTask.doInBackground(StreamWebRtcConfigurationFragment.java:315) at com.amazonaws.kinesisvideo.demoapp.fragment.StreamWebRtcConfigurationFragment$UpdateSignalingChannelInfoTask.doInBackground(StreamWebRtcConfigurationFragment.java:301) at android.os.AsyncTask$3.call(AsyncTask.java:389) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:292) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:929) Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.ContextCompat" on path: DexPathList[[zip file "/data/app/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24-X13RUAttPR4LP-8lUMZQNQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24-X13RUAttPR4LP-8lUMZQNQ==/lib/arm64, /data/app/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24-X13RUAttPR4LP-8lUMZQNQ==/base.apk!/lib/arm64-v8a, /system/lib64, /hw_product/lib64, /system/product/lib64, /prets/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:209) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at java.lang.Class.classForName(Native Method)  at java.lang.Class.forName(Class.java:454)  at java.lang.Class.forName(Class.java:379)  at com.amazonaws.mobile.client.AWSMobileClient.isNetworkAvailable(AWSMobileClient.java:751)  at com.amazonaws.mobile.client.AWSMobileClient.getUserStateDetails(AWSMobileClient.java:963)  at com.amazonaws.mobile.client.AWSMobileClient.waitForSignIn(AWSMobileClient.java:903)  at com.amazonaws.mobile.client.AWSMobileClient.getCredentials(AWSMobileClient.java:355)  at com.amazonaws.kinesisvideo.demoapp.fragment.StreamWebRtcConfigurationFragment.getAwsKinesisVideoClient(StreamWebRtcConfigurationFragment.java:272)  at com.amazonaws.kinesisvideo.demoapp.fragment.StreamWebRtcConfigurationFragment.access$300(StreamWebRtcConfigurationFragment.java:53)  at com.amazonaws.kinesisvideo.demoapp.fragment.StreamWebRtcConfigurationFragment$UpdateSignalingChannelInfoTask.doInBackground(StreamWebRtcConfigurationFragment.java:315)  at com.amazonaws.kinesisvideo.demoapp.fragment.StreamWebRtcConfigurationFragment$UpdateSignalingChannelInfoTask.doInBackground(StreamWebRtcConfigurationFragment.java:301)  at android.os.AsyncTask$3.call(AsyncTask.java:389)  at java.util.concurrent.FutureTask.run(FutureTask.java:266)  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:292)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)  at java.lang.Thread.run(Thread.java:929)  2021-12-09 17:04:24.684 23632-23882/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 D/AWSMobileClient: waitForSignIn: userState:SIGNED_OUT 2021-12-09 17:04:24.684 23632-23882/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 D/CognitoCachingCredentialsProvider: Loading credentials from SharedPreferences 2021-12-09 17:04:24.687 23632-23882/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 E/AWSKeyValueStore: com.amazonaws.internal.keyvaluestore.KeyNotFoundException: Error occurred while accessing AndroidKeyStore to retrieve the key for keyAlias: com.amazonaws.android.auth.aesKeyStoreAlias 2021-12-09 17:04:24.687 23632-23882/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 I/AWSKeyValueStore: Deleting the encryption key identified by the keyAlias: com.amazonaws.android.auth.aesKeyStoreAlias 2021-12-09 17:04:24.689 23632-23882/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 E/AWSKeyValueStore: Error in retrieving the decryption key used to decrypt the data from the persistent store. Returning null for the requested dataKey = us-east-2_lqSwBO8Q9.expirationDate 2021-12-09 17:04:24.689 23632-23882/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 D/CognitoCachingCredentialsProvider: No valid credentials found in SharedPreferences 2021-12-09 17:04:24.689 23632-23882/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 D/CognitoCachingCredentialsProvider: Making a network call to fetch credentials. 2021-12-09 17:04:24.990 23632-23882/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 D/CognitoCachingCredentialsProvider: Identity id is changed 2021-12-09 17:04:24.990 23632-23882/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 D/CognitoCachingCredentialsProvider: Saving identity id to SharedPreferences 2021-12-09 17:04:24.991 23632-23882/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 D/CognitoCachingCredentialsProvider: Clearing credentials from SharedPreferences 2021-12-09 17:04:25.305 23632-23632/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 I/Choreographer: Skipped 37 frames! The application may be doing too much work on its main thread. 2021-12-09 17:04:25.314 23632-23632/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 I/DecorView[]: old windowMode:0 new windoMode:1 2021-12-09 17:04:25.342 23632-5002/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 D/HiTouch_PressGestureDetector: onAttached, package=com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24, windowType=2, mHiTouchRestricted=false 2021-12-09 17:04:25.348 23632-23841/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 D/mali_winsys: EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000 2021-12-09 17:04:25.353 23632-23841/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 D/OpenGLRenderer: disableOutlineDraw is true 2021-12-09 17:04:25.355 23632-23632/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 I/HwViewRootImpl: removeInvalidNode jank list is null 2021-12-09 17:04:25.369 23632-23632/com.amazonaws.kinesisvideo.webrtc.demoapp.minsdk24 D/DecorView: showOrHideHighlightView: hasFocus=false; winMode=1; isMrgNull=true

Sleepingbug commented 2 years ago

I solved this problem. I just swapped the two Pool Ids.