跳至內容

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

已提問 3 年前檢視次數 449 次
1 個回答
0
已接受的答案

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

已回答 3 年前
專家
已審閱 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。