CC.
CC.

Reputation: 2928

Hide signup in amplify react application

I'm working on an application built with amplify and react. I have an auth module.

I want basically to have only one user, I don't want to let peoples create accounts.

My question is how to hide the sign up option ?

Thanks.

C.C.

Upvotes: 2

Views: 3139

Answers (4)

llama
llama

Reputation: 1651

Disable signup in the backend

const { cfnUserPool } = backend.auth.resources.cfnResources

cfnUserPool.adminCreateUserConfig = {
  // disables self sign-up for non-federated users
  allowAdminCreateUserOnly: true,
}

Upvotes: 0

Andrei
Andrei

Reputation: 1863

In case someone is still looking into this, and you're using:

import {Authenticator} from "@aws-amplify/ui-react";

The solution is to pass the flag to the Authenticator component directly, as per the official documentation:

<Authenticator hideSignUp={true}>

Upvotes: 1

Ger
Ger

Reputation: 949

In App.css, or whatever appropriate style sheet, put

.amplify-tabs {
  display: none;
}

but make absolutely sure that it is imported after @aws-amplify/ui-react/styles.css.

I don't use style sheets, preferring inline styling, but this solution was so elegant I am making an exception!

https://ui.docs.amplify.aws/react/connected-components/authenticator/customization#additional-css-styling

Upvotes: 2

Michael S. Molina
Michael S. Molina

Reputation: 732

You can use the hideSignUp property:

<AmplifyAuthenticator>
  <AmplifySignIn slot="sign-in" hideSignUp></AmplifySignIn>
</AmplifyAuthenticator>

Upvotes: 3

Related Questions