AWS Cognito's passwordless authentication working on localhost but throwing error Invalid redirectURL on live

29 views Asked by At
Passwordless.configure({
cognitoIdpEndpoint: import.meta.env.VITE_COGNITO_IDP_ENDPOINT,
clientId: import.meta.env.VITE_CLIENT_ID,
fido2: {
baseUrl: import.meta.env.VITE_FIDO2_BASE_URL,
authenticatorSelection: {
  userVerification: "required",
 },
},
userPoolId: import.meta.env.USER_POOL_ID,
debug: console.debug
});

component

    import { Passwordless } from "amazon-cognito-passwordless-auth";
    import { Passwordless as PasswordlessComponent, Fido2Toast,} from "amazon- 
    cognito-passwordless-auth/react";
    import "amazon-cognito-passwordless-auth/passwordless.css";
    import "@cloudscape-design/global-styles/index.css";

         <Box>
            <PasswordlessComponent
              brand={{
                customerName: "App Name",
              }}
            ></PasswordlessComponent>
            <Fido2Toast />
          </Box>

I am encountering an issue with implementing password-less authentication in my React.js application. While the authentication process works seamlessly on localhost, I encounter an "invalid redirect URI" error upon deploying the application to a live environment.

My application is hosted on an EC2 instance and is being served through Nginx. Within the AWS Cognito dashboard, I have configured the appropriate URL in the user pool app client settings to handle the redirection on the "Allow Callback URL."

Now, I'm uncertain whether this issue stems from a misconfiguration on the front-end or if there's an issue within the AWS Cognito dashboard settings.

0

There are 0 answers