CognitoUser.authenticate in react native throws [TypeError: undefined is not a function]

23 views Asked by At

I am trying to get authentication to work with aws cognito with a userpool, on my react native app using expo. When running the code, upon wrong credentials, I get the expected AuthenticationException, but upon correct credentials I get an error that does not provide much info and when I turn on stack tracing it seems like it is somewhere in the internal source code, e.g. a library issue, that it fails.

This is the code, and the error happens within authenticateUser and calls onFailure resulting

Usefule part of stacktrace:

TypeError: undefined is not a function
    at authenticateUserInternal (http://192.168.18.16:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false:126587:46)
...
...

code:

      const session = await new Promise<CognitoUserSession>(
        (resolve, reject) => {
            cognitoUser.authenticateUser(authenticationDetails, {
              onSuccess: resolve,
              onFailure: reject,
            });
        }
      );

I looked for installation issues, but could not find anything related to expo or npm, etc. Any suggestions?

0

There are 0 answers