enough-sugar-12780
04/29/2024, 9:29 PMchilly-king-10285
04/29/2024, 9:29 PMchilly-king-10285
04/29/2024, 9:29 PMenough-sugar-12780
04/29/2024, 9:30 PMchilly-king-10285
04/29/2024, 9:30 PMchilly-king-10285
04/29/2024, 9:30 PMnpx create-next-app@latest --typescript cd <your-project-directory>
[Source](https://www.ory.sh/docs/getting-started/integrate-auth/nextjs) 2. Install Ory's SDK and Integration Tools: Ory provides integration tools that quickly combine Ory with Next.js. Install Ory's SDK, used to make API calls to Ory, and Ory's Integration Tools for JavaScript frameworks using the following command: npm i --save @ory/integrations @ory/client
[Source](https://www.ory.sh/docs/getting-started/integrate-auth/nextjs#install-ory) 3. Create a special route: Create a special route in [...paths].js
at pages/api/.ory/
. This route connects your Next.js app with Ory's APIs and ensures that all cookies and credentials are set up. Without it, your Next.js application won't be able to talk to Ory's APIs. [Source](https://www.ory.sh/docs/getting-started/integrate-auth/nextjs#install-ory) 4. Require login to access the home page: Add a session check to the default home page of the Next.js example application to check whether the user is signed in, and redirect them to the login page if not. [Source](https://www.ory.sh/docs/getting-started/integrate-auth/nextjs#require-login-to-access-the-home-page) Please refer to the official Ory documentation for more detailed instructions on setting up the IdentityApi.