GithubHelp home page GithubHelp logo

ymaghzaz / aws-amplify-react-custom-ui Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 4.0 503 KB

Building a Custom UI Authentication For AWS Amplify

HTML 3.88% JavaScript 95.59% CSS 0.52%
react aws-amplify aws-amplify-react authenticator customization ui amazon-cognito cognito javascript javascript-library

aws-amplify-react-custom-ui's People

Contributors

dependabot[bot] avatar howyi avatar melbarch avatar ymaghzaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aws-amplify-react-custom-ui's Issues

How can I pass authData between components?

First of all, thanks for such a great package, the UI is looking great thanks to this customisation.

I have created 2 class components, one for SigIn, another for NewPassword, i.e. overriding the auto-generated password when an admin creates a new account in Cognito.

The components are successfully loaded like this

AmplifyCustomUi.setSignIn(SignIn);
AmplifyCustomUi.setRequireNewPassword(NewPassword);

The SignIn component is able to create a Cognito session and returns the payload in the user result object.

const user = await Auth.signIn(username, password);

if (!user.challengeName) {
  this.changeState("signedIn", user);
  return true;
}

if (user.challengeName === "NEW_PASSWORD_REQUIRED") {
  this.changeState("requireNewPassword", user);
}
return false;

The problem is that the NewPassword component does not receive the user content via props.
Could you provide an example of how could I retrieve the user, so that I can invoke the following Amplify function to set the initial password?

const result = await Auth.completeNewPassword(user, password, {});

thanks very much,

Jaume

ConfirmSignUp custom UI does not keep the user signed in

Hello. I am using your library to create a custom ConfirmSignUp. It works great for SignIn and SignUp but when I want to confirm the Sign Up it renders a blank page, and if I refresh it takes me back to sign in.
Here is my function :
onSubmit = (event) => {
const { username, verificationCode } = this.state;

    Auth.confirmSignUp(username, verificationCode)
        .then((user) => {
            this.changeState("signedUp", user);
        })
        .catch(err => {
            this.setState(updateByPropertyName("error", err));
        });
    event.preventDefault();

};

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.