DevLeonardoCommunity / github-stats

Aggregating and displaying YOUR GitHub Stats in meaningful metrics (we learn web development in the meantime)
https://public-github-stats.vercel.app
MIT License
71 stars 37 forks source link

feat: middleware.ts created for protect the routes #51

Closed black-arm closed 1 year ago

Balastrong commented 1 year ago

Thank you for the PR!

When I navigate to a protected page I now get this error, we should probably make sure it redirects to the homepage. Any idea?

image

black-arm commented 1 year ago

the redirect work if we deleted secret variable from [...nextauth].ts and in .env.local we added the NEXTAUTH_SECRET

Screenshot 2023-08-25 alle 09 58 04 Screenshot 2023-08-25 alle 10 01 40 image

how do we want to proceed? Do we update the .env and documentation or do we find to way to work with secret variable?

Balastrong commented 1 year ago

Finding a way that does not require an extra variable would be great :)

Balastrong commented 1 year ago

Still thinking about it... we might entirely replace SECRET with NEXTAUTH_SECRET and leave a value there already in .env.example to keep onboarding easy

black-arm commented 1 year ago

Ok. So, I replace SECRET with NEXTAUTH_SECRET in .env.example and remove

secret: process.env.SECRET

in [...nextauth].ts

Balastrong commented 1 year ago

Exactly, and you can also give a default value to NEXTAUTH_SECRET in .env.example so that it just works :)