aws / aws-sdk-net-extensions-cognito

An extension library to assist in the Amazon Cognito User Pools authentication process
Apache License 2.0
102 stars 49 forks source link

Method not found AmazonCognitoIdentityProviderClient #43

Closed TrueGeek closed 3 years ago

TrueGeek commented 4 years ago

I'm getting an error of System.MissingMethodException at this line:

var provider = new AmazonCognitoIdentityProviderClient(new AnonymousAWSCredentials(), FallbackRegionFactory.GetRegionEndpoint());

The full error is: Method not found: void Amazon.CognitoIdentityProvider.AmazonCognitoIdentityProviderClient..ctor(Amazon.RegionEndpoint)

I'm on Visual Studio 2019 for Mac.

It does look like a couple other people may be having the same issue.

Since I don't get the dependencies added automatically by the Windows SDK tools and templates I think it may just be that I'm missing something there. I've added AWSSDK.Core. I tried also adding AWSSDK.CognitoIdentity and AWSSDK.CognitoIdentityProvider even though they are already included as dependencies. No luck though.

Obviously the constructor does exist at design time - I can drill down on it in the IDE and see it inside the nuget package. But when I run the code my app will crash if I include any method that has a new AmazonCognitoIdentityProviderClient() inside it.

klaytaybai commented 4 years ago

Hi @TrueGeek, I wasn't able to reproduce your problem. You may have a conflict in your dependencies. Do you have any other references to AWSSDK.CognitoIdentityProvider? Which version are you using? Are you using Xamarin, like the Stack Overflow question example you posted?

TrueGeek commented 4 years ago

I am using Xamarin, yes.

I have references to:

Amazon.Extensions.CognitoAuthentication (1.0.3) AWSSDK.CognitoIdentity (3.3.101) AWSSDK.CognitoIdentityProvider (3.3.103.16) AWSSDK.Core (3.3.103.62)

FranciscoYimes commented 4 years ago

I have the same issue using Android. Did you resolve it?

TrueGeek commented 4 years ago

Haven’t resolved it, but I haven’t had time to look at it either. Work has been keeping me busy this month and this is for a side project.

shayanaijaz commented 4 years ago

Running into the same issue using Xamarin. Did you find a solution?

keriki101 commented 4 years ago

I think I found the answer! You need to provide the credentials and RegionalEndPoint inside the var provider = new AmazonCognitoIdentityProviderClient(new AnonymousAWSCredentials(). For example like this

var provider = new AmazonCognitoIdentityProviderClient(new AnonymousAWSCredentials(constants.credentials, constants.RegionalEndpoint);qw

The credentials are what you have declared for Cognito to work

    public static CognitoAWSCredentials credentials = new CognitoAWSCredentials(
        "eu-west-<Your Pool ID>", // Identity pool ID
        RegionEndpoint.EUWest2 // Region
    );
ashishdhingra commented 3 years ago

Hi @TrueGeek,

Good afternoon.

Please let me know if this is still an issue or if it could be closed.

Thanks, Ashish

github-actions[bot] commented 3 years ago

This issue has not recieved a response in 2 weeks. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.