Skip to content

Instantly share code, notes, and snippets.

@SahanAmarsha
Created February 28, 2021 20:32
Show Gist options
  • Save SahanAmarsha/d85e18865ee7b167c85a495765f801de to your computer and use it in GitHub Desktop.
Save SahanAmarsha/d85e18865ee7b167c85a495765f801de to your computer and use it in GitHub Desktop.
_app.js
import { Amplify } from "aws-amplify";
import { AmplifyAuthenticator } from "@aws-amplify/ui-react";
import awsExports from "../src/aws-exports";
import "../styles/globals.css";
Amplify.configure({ ...awsExports, ssr: true });
function MyApp({ Component, pageProps }) {
return (
<AmplifyAuthenticator>
<Component {...pageProps} />
</AmplifyAuthenticator>
);
}
export default MyApp;
@R4YM3
Copy link

R4YM3 commented May 29, 2022

This did not work me.
I had to update it to:

import { Amplify } from "aws-amplify";
import { Authenticator } from "@aws-amplify/ui-react";
import awsExports from "../src/aws-exports";
import "../styles/globals.css";

Amplify.configure({ ...awsExports, ssr: true });
function MyApp({ Component, pageProps }) {
  return (
    <Authenticator>
      <Component {...pageProps} />
    </Authenticator>
  );
}
export default MyApp;

FYI, I retrieved the orignal snippet from https://enlear.academy/complete-guide-to-amplify-and-next-js-7dd2b683282a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment