https://www.ory.sh/ logo
m

many-garden-6507

04/20/2022, 9:06 AM
Following this example https://www.ory.sh/login-spa-react-nextjs-authentication-example-api-open-source/ i have implemented login and signup in next js and it works, but if the user has not login but if they type the route address in browser they are still directed to that page, any solution for this.
p

proud-plumber-24205

04/20/2022, 9:10 AM
Hi, you need to check that the user is logged in through a route guard or before the component is rendered. Another solution is to add a reverse proxy in front of your application that checks if the user is authenticated (has a session cookie) before forwarding to a route on your app other than login/signup
1
m

many-garden-6507

04/20/2022, 9:11 AM
any documentation link for route gaurd?
p

proud-plumber-24205

04/20/2022, 9:21 AM
m

many-garden-6507

04/20/2022, 9:25 AM
Thank you!
One last thing https://www.ory.sh/login-spa-react-nextjs-authentication-example-api-open-source/ where does this example store information about users etc, like is there any kind of database and where it is, and what kind of backed is there with this exmple because i did not use kratos docker or cloud
p

proud-plumber-24205

04/20/2022, 9:41 AM
this uses the cloud since you most likely exported
Copy code
# If you run Ory Kratos in Ory Cloud:
export ORY_SDK_URL=<https://my-project.projects.oryapis.com>
also from the guide
Copy code
Per default, this app uses the public playground deployment of Ory Kratos at <https://playground.projects.oryapis.com>. To use it, simply run:
m

many-garden-6507

04/20/2022, 9:42 AM
i did not use this export statement of any kind just cloned the project and it is working
p

proud-plumber-24205

04/20/2022, 9:43 AM
per default it exports that and uses
Copy code
<https://playground.projects.oryapis.com>
m

many-garden-6507

04/20/2022, 9:46 AM
Got it Thank you.
2 Views