首先,我使用amplify configure
. 我是在AWS Amplify 文档的帮助下完成的。然后我成功地将身份验证添加到我的放大项目中,使用amplify add auth
和amplify push
。我遵循了AWS - Authentication with Amplify Doc中的所有步骤
我的长App.js
这样
import React from 'react';
import { withAuthenticator, AmplifySignOut } from '@aws-amplify/ui-react';
import Amplify, { Auth } from 'aws-amplify';
import awsconfig from './aws-exports';
Amplify.configure(awsconfig);
const App = () => (
<div>
<AmplifySignOut />
My App
</div>
);
export default withAuthenticator(App);