jaredhanson / passport

Simple, unobtrusive authentication for Node.js.
https://www.passportjs.org?utm_source=github&utm_medium=referral&utm_campaign=passport&utm_content=about
MIT License
22.94k stars 1.24k forks source link

Configure authentication using "local" strategy and "basic" at the SAME TIME #295

Open mpaezmolina opened 10 years ago

mpaezmolina commented 10 years ago

Hello, I'm trying to setup the framework to use both "local" strategy and "basic". Basically what I want is to authenticate an API that I created and that I access it using to types of clients, an AngularJS web app and a Mobile app. The idea that I have is this: 1- If I use the web app and I'm logged in using "local" strategy then I can hit the API end point from the browser because user is in the cookie. So "basic" authentication should not be used in this case. 2- But if I'm not logged-in using "local" strategy, and I'm hitting the API end point outside a browser's web app, I want to be able to authenticate via "basic" strategy, with the credentials set in the HTTP header.

Is this possible? I can find documentation about this, only some post out there which did not worked for me. Can anyone point out how to do this? Thanks!! The framework is great by the way.

chinmayrane commented 9 years ago

Any update on this? Looking for a solution to a very similar usecase!