SohoHouse / nuxt-oauth

Simple OAuth2 integration for your Nuxt app
MIT License
122 stars 27 forks source link

Authenticate Server Middleware #43

Open benrolfe opened 4 years ago

benrolfe commented 4 years ago

I understand how to protect pages and components, but I would like to know if it's possible to only allow access for authenticated users to an internal API endpoint?

Is it possible to use server middleware? See https://nuxtjs.org/api/configuration-servermiddleware/

Let me know if anything needs clarification.

samtgarson commented 4 years ago

Hey @benrolfe, OAuth used for securing frontends, not APIs so I'm not quite sure I understand how you'd like it to work?

Part of the process is that the server redirects the user to login with a third party, I'm not sure how that could work with an API.

Maybe if you could explain further I can try to help.