1 Answer
- Newest
- Most votes
- Most comments
0
In case it helps anyone else here is how I ended up solving this
I just created a plain old react project with vite and then added these to the App.tsx (or App.jsx if you are using Javascript, I am using typescript) The trick is to just use the amplify libraries as you would use any other library - without using amplify cli etc.
import "./App.css";
import { Authenticator } from "@aws-amplify/ui-react";
import { Amplify } from "aws-amplify";
Amplify.configure({
Auth: {
Cognito: {
userPoolClientId: "<my client id>",
userPoolId: "<my pool id>",
},
},
});
function App() {
const [count, setCount] = useState(0);
return (
<Authenticator socialProviders={["google"]}>
{({ signOut, user }) => (
<main>
<h1>Hello {user?.username}</h1>
<button onClick={signOut}>Sign out</button>
</main>
)}
</Authenticator>
);
}
export default App;
answered 4 months ago
Relevant content
- Accepted Answer
- Accepted Answerasked a year ago
- asked 8 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago