Salta al contenuto

Cognito otpauth name using hosted UI

0

HI,

I'm using the hosted Cognito UI for login/reset/TOTP and I want the google authenticator code to show my custom application name, but it shows 'AWSCognito'.

I understand using the API only I can amend AWSCognito as seen hereotpauth://totp/AWSCognito:${email}?secret=${code}&issuer=https://cognito-idp.ap-southeast-2.amazonaws.com/

Is there a way with the hosted UI?

Thx Dan

posta 3 anni fa449 visualizzazioni
1 Risposta
0
Risposta accettata

This has been solved. For those needing it:

import {
  Authenticator,
  Heading,
  Text,
  ThemeProvider,
  Theme,
  useTheme,
  View,
  useAuthenticator,
  Button,
} from '@aws-amplify/ui-react'

then wrap your app in the auth provider

 <Authenticator
          hideSignUp={true}
          formFields={formFields}
          components={components}
        >
          <Layout>
            <main>
              <Component previousPathname={previousPathname} {...pageProps} />
            </main>
          </Layout>
        </Authenticator>

and configure formField

const formFields = {
  setupTOTP: {
    QR: {
      totpIssuer: `CompanyName - ${process.env.NEXT_PUBLIC_ENV}`,
      totpUsername: email,
    },
...
  },
}

Thx Dan

con risposta 3 anni fa
ESPERTO
verificato un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.