Update suggested ways of securing pages and API routes
See original GitHub issueIn https://github.com/vercel/next.js/issues/34316#issuecomment-1039037314 I concluded that getInitialProps
really does not play well with our auth model. There are simply much better solutions for this now.
We should discourage the usage of it entirely.
https://next-auth.js.org/tutorials/securing-pages-and-api-routes should be updated to also mention Middleware support and finally decide how and where we should document getServerSession
(#1535)
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Securing pages and API routes - NextAuth.js
Securing pages and API routes. You can easily protect client and server side rendered pages and API routes with NextAuth.js.
Read more >Best practices for REST API security: Authentication and ...
If you have a REST API accessible on the internet, you're going to need to secure it. Here's the best practices on how...
Read more >API Routes: Introduction - Next.js
API routes provide a solution to build your API with Next.js. Any file inside the folder pages/api is mapped to /api/* and will...
Read more >How To Protect Your API Key In Production With Next.js API ...
The reason why we're writing the API call at the server-side is for securing our API key, and Next.js already makes it an...
Read more >API security best practices | Google Maps Platform
While it is possible to secure API keys after they're created and in use, there can be different constraints based on how the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
now it’s well structured. previously i had to switch b/w tutorials and docs.
I’m not really sure actually. I want the Client page to go away mostly, or document how a framework-specific client should be implemented (similar to how we have the REST API docs).
getServerSession
is Next.js specific, so I might put it under https://next-auth.js.org/configuration/nextjs probably.