-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using PassportJS to manually authenticate a username/password #454
Comments
A stand alone version of passport would doors to so many more use cases, i'm trying to adapt it to |
@Monteirocode same here. were you successful as of now or did you use different modules? |
@gonsfx I concluded it's better doing it manually, once you get your head around |
Here's an example of manually signing up and logging in a user. Yep, it looks nasty:
I'm making user of GraphQL as well, which expects a promise, not a callback. |
Great solution @StephenGrider. I too am using GraphQL with Password, and I'm amazed at how difficult it is! A simple
Does the Passport team object philosophically to a method like this, or is it simply an issue of "no one has submitted a PR yet"? |
Yes @machineghost, seems @jaredhanson doesn't like promises at all. See #536. |
So, is passport meant to be exclusively used for express or connect ? I'm also trying to use it to authenticate users to my GraphQL API, but it's been quite hard. |
I asked about this on Stack Overflow and someone there posted a solution. A basic Passport function would be more ideal, but in the meantime this solution works, so hopefully it helps some people: https://stackoverflow.com/questions/47899786/how-can-i-authenticate-a-graphql-endpoint-with-passport |
+1 for having this feature. It would be very useful for use-cases such as authentication in GraphQL context as other commentors have mentioned. |
I would also like to echo my desire for a feature like this. My use case is: Using Express and PassportJS to authenticate users. I am doing this across multiple subdomains on the same host, so what I am trying to accomplish is a bit more complicated than described, but... a way to attach a single user to a passport strategy or be able to manually log a user in with their credentials using PassportJS, where my application looks to when it determines whether or not a user has access to a resource, would be really useful. There are so many articles online that say you don't need PassportJS to do anything and that it's making oauth more difficult, yet a lot of us are out there trying to use it anyway. Maybe this would help bridge that gap? |
Im trying to use PassportJS as a means of authentication for an application I'm writing. The application itself is more of a CLI tool, which doesn't use express.
I was trying to find a way to use PassportJS to authenticate a username/password manually, but in the examples inside the documentation, you're actually using ExpressJS and setting Passport as the authentication schema.
Is there any documentation on just how to take a username/password, authenticate, and execute a callback or preferably return a promise?
The text was updated successfully, but these errors were encountered: