Is there any middleware library like PassportJS for Fastify? - node.js

I was experimenting with NestJS and Fastify as an underlying HTTP framework but soon ran into a problem when tried implementing an OAuth for Google signup. Since PassportJS has been my goto library for this purpose, I thought it would work here too. Later realized that PassportJS is only compatible with Express-based web apps.
Is there a way to make PassportJS work with Fastify or a good alternate for it?

Related

I created an authentication api with express, what is the best way of consuming the api with Vuejs

I have an authentication api with nodejs and express fully working with ejs template. But I’d like to know how to use vuejs for the frontend instead of ejs
I already built the ui with Vuejs, then I created the api with nodejs/express and tested it with ejs.
I’m having issues with the authentication system using my vuejs ui, I can’t seem to call the api and persist form data properly.
Thanks

How to do facebook authentication in React Native with nodejs as backend?

I have following problem:
I have an App with React Native and I need authentication via Facebook.
I figured out how to do it with expo and the expo-facebook but my problem is, that I also need authentication in the backend, which is done with NodeJs.
What is the right approach to do it, when the backend also needs to be secure?
I looked thru the internet for ours and didn´t find any tutorial...
Thanks in advance!
Check Passportjs. It's an authentication middleware for Nodejs. Search for the relevant strategy. Should be fairly easy to implement.

Redirect user to angular app after login with nodejs/express

I am trying to build an application in nodejs and angular 6, where the login is done with node and after successful authentication the user is redirected to an angular application. I have looked at many resources online but only seem to find examples of either angular apps with login screens (that call nodejs API endpoints to pass user credentials), or with nodejs using express and Passport. If anyone can point me in the right direction for an example of this I would be extremely greatful.
I had created a repo similar with what you're looking for.
Here's the link to the project: ngx-express-passport-setup
You can clone it & try testing it on your environment. Setup instruction is provided.
Provided with all the instructions on ReadMe.Md for someone who wants to use Passport via local, google+, facebook and twitter Step by Step.
This project uses Angular5, NodeJS and ExpressJS
Hope this will help/guide you with your problem if ever you'll decide on using PassportJS as your Authentication as it is quite actually a popular tool for NodeJS.

Using Oauth2 Node library in React app

currently I have a React app, there I need to authenticate using OAuth2. I have the server, url's,callbacks, and clients already, now the only thing that I need is to exchange the code sent by the OAuth2 server for an access token.
I was reviewing some libraries that are made for javascript to handle these situations, for example:
Simple Oauth2
Passport
I was trying with simple-oauth2 however I see that it's made for node.js applications, and they use require to import the libraries. My question is, can I use that kind of libraries on client side using React? if so, which is the correct way to import that library inside my component? because readin their examples they are focus on express/node apps. Am not really a Javascript or node developer so I need help in this.

Using server-side php to authenticate javascript calls

I'm using a Symfony2 backend and AngularJS frontend in one project. Symfony is used to show the initial view and provide a RESTful API with AngularJS embedded into the view.
Basically AngularJS will be used for the frontend (view) and calling Symfony API to interface with the database (model).
I have a bunch of Angular http gets and posts which exposes the URL to my API . What would be the best way to secure the API in my scenerio?
I do have access to server-side with Angular but how do I pass that authentication from Symfony to Angular?
Thanks for the help.
This is a common need, and there are several approaches - but they usually settle on using sessions.
You might find this article to be a good overview of an AngularJS-specific implementation...
http://www.espeo.pl/2012/02/26/authentication-in-angularjs-application

Resources