- Notifications
You must be signed in to change notification settings - Fork 5.8k
Open
Labels
BugAn update to fix incorrect code or typos.An update to fix incorrect code or typos.KotlinThis issue relates to the AWS SDK for KotlinThis issue relates to the AWS SDK for Kotlin
Description
Hi,
Hope you are all well.
I want to create thing via android kotlin.
Kotlin Code:
fun initAWSIotClient(context: Context) { val credentialsProvider = CognitoCachingCredentialsProvider( context, "MY_USER_POOL_ID", MY_REGION ) iotClient = AWSIotClient(credentialsProvider) createThing("MyNewThing") } private fun createThing(thingName: String) { Thread { try { val createThingRequest = CreateThingRequest() createThingRequest.thingName = thingName val createThingResult = iotClient.createThing(createThingRequest) app.l("Thing created: ${createThingResult.thingName}") } catch (e: Exception) { app.l("Error creating thing: $e") } }.start() } However, I receive error:
Failure to get credentials com.amazonaws.services.cognitoidentity.model.NotAuthorizedException: Unauthenticated access is not supported for this identity pool. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException; Request ID: xxxxx) I also added different permissions to the IAM role like AWSIoTFullAccess, AWSIoTThingsRegistration, and test custom policy:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:CreateThing", "iot:DescribeThing", "iot:DeleteThing" ], "Resource": "*" } ] } but the error persists. Do you know how I should solve the error?
Thank you.
Metadata
Metadata
Assignees
Labels
BugAn update to fix incorrect code or typos.An update to fix incorrect code or typos.KotlinThis issue relates to the AWS SDK for KotlinThis issue relates to the AWS SDK for Kotlin