This is a simple example application using @ory/elements-react & Next.js app router.
- Sign up for an account at https://console.ory.sh
- Create a new or use an existing project
- Go to https://console.ory.sh/projects/current/settings and copy the API endpoints URL
- Set
NEXT_PUBLIC_ORY_SDK_URLin the.envfile to your project's API endpoints URL - Set
ORY_PROJECT_API_TOKENin the.envfile to your project's API token. You can create an API key in the Ory Console. - Run
npm install - Run
npm run devand open navigate to http://localhost:3000
Warning
For convenience Ory provides a default "test" project, that can be used to interact with Ory's APIs. It is a public project, that can be used by anyone and data can be deleted at any time. Make sure to use a dedicated project.
To successfully deploy to Vercel, you need to set the following environment variables in your Vercel project:
NEXT_PUBLIC_ORY_SDK_URL- The URL of your Ory project. This is the same URL you set in your.envfile.ORY_PROJECT_API_TOKEN- The API token for your Ory project. This should be a dedicated key for production.
- All self-service user flows Ory supports
- User Logout
The project files reside in the app/ directory:
app/auth- contains the page files for the user auth flowsapp/settings- contains the page file for the settings flowapp- contains the root page file and layout.
If you have any issues using this examples, or Ory's products, don't hesitate to reach out via the Ory Community Slack.
This section is relevant to Ory engineers only. When running a local Ory Network
instance, you will need to disable TLS verification and set the
NEXT_PUBLIC_ORY_SDK_URL to https://<slug>.projects.oryapis:8080:
NODE_TLS_REJECT_UNAUTHORIZED=0 npm run dev