aws / aws-aspnet-cognito-identity-provider

ASP.NET Core Identity Provider for Amazon Cognito
https://aws.amazon.com/developer/language/net/
Apache License 2.0
215 stars 89 forks source link

Operation canceled exception when trying to use AdminDeleteUserAsync #100

Closed simax closed 5 years ago

simax commented 5 years ago
var deleteUserRequest = new AdminDeleteUserRequest { Username = username, UserPoolId = _poolId};
var config = new AmazonCognitoIdentityProviderConfig { RegionEndpoint = Amazon.RegionEndpoint.EUWest1 };
var adminDeleteUserResponse = await new AmazonCognitoIdentityProviderClient(config)
                                                        .AdminDeleteUserAsync(deleteUserRequest);

Executing the code above is throwing an exception ("The operation was canceled.")

I wonder if this is related to issue 41?

I tried some of the advice mentioned on the other issue like passing an access key and secret (which I don't want to do anyway) and also adding the "AmazonCognitoPowerUser" policy to my IAM account but then I got a different exception stating:

User: arn:aws:iam::123546789:user/xxxxxxx is not authorized to perform: cognito-idp:AdminDeleteUser on resource: arn:aws:cognito-idp:eu-west-1:123456789:userpool/eu-west-1_1xxxxx with an explicit deny"

If the issues are related is there any ETA on a fix? If they're not, do you have any suggestions on how I could get this to work.

Thanks

sstevenkang commented 5 years ago

This seems to be IAM permission issue. Why do you think this is a bug in the library?

simax commented 5 years ago

Yep, you're right. After some further digging it was an IAM permission issue.