Serving protected images in Next.js

Viewed 557

I'm using Next.js along with next-auth for OAuth and want to serve images that would be accessible only to authenticated users. Images are stored on the same machine as Next.js app, e.g. in assets/images directory. How would I serve them from there? Do I need to create an api endpoint inside of api directory and fetch them when rendering a protected page?

0 Answers
Related