What are the steps to checking login functionality utilizing the Facebook and Google APIs?

I am currently utilizing the express framework, along with chai for testing purposes.

When it comes to local login, I have been testing by passing data such as {mobile_number, otp}. Depending on the response received, the test either passes or fails.

Now, my challenge lies in figuring out how to properly test the login functionality using Facebook and Google APIs. What would be considered a best practice in this scenario? Below are the endpoints that I need to work with:

  • GET :- /auth/facebook
  • GET :- /auth/google

Answer №1

In order to implement this, you must use a third-party redirection method. Testing can be done locally using a user interface that redirects to a third party such as Facebook or Google. It is not possible to test by directly sending raw data to your backend API.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Obtain the parameter of a parent function that runs asynchronously

Here's the code snippet I'm working with: function modify( event, document ) { console.log( "document name", document ); //I need it to be 'file', not 'document'. documents.clients( document, function( clientOfDocument ...

How can we access a value within a deeply nested JSON object in Node.js when the key values in between are not

In the nested configuration object provided below, I am seeking to retrieve the value associated with key1, which in this case is "value1". It's important to note that while key1 remains static, the values for randomGeneratedNumber and randomGenerated ...

Uploading files with Express using Multer

I'm having trouble uploading an image using multer because I keep getting the error message "uploads is not a function." Here's my code: var multer = require('multer'); var uploads = multer({dest: './images'}); app.post(&apos ...

Launch your React JS website on GitHub Pages

Recently, I successfully developed my first React JS application by utilizing the create-react-app command line tool. Prior to executing npm run build However, upon attempting to access the GitHub page at username.github.io/project-name/public, a 404 err ...

Detecting cookies between Express and Passport communication

When users navigate to http://localhost/login, they are immediately redirected to Facebook for confirmation of application usage. After authorization, Facebook communicates with http://localhost/login?code= using a unique code that grants the server access ...

Retrieve information received from an HTTP request in Laravel

How can I retrieve data from an https request in Laravel? The data I am receiving currently looks like this: {"{\"email\":68,\"token\":\"945672295777710090\"}":null}.\\dd(Reque ...

Add several rows to the transactions table, and in case one insertion fails, allow the remaining rows to be added

I am working on an application that extracts hotel names and addresses from various websites. My challenge is inserting this data in batches of 10 into a MySQL database. If any insert fails (for example, if the hotel name exceeds 100 characters while the ...

Error encountered on macOS Mojave M1 when trying to set global permissions for npm bin folder

After running the npm doctor command, here is the output I received: npm ERR! checkFilesPermission Missing permissions on /opt/homebrew/bin/.keepme (expect: executable) Check Value Recommendation/Notes npm ping ...

M.E.A.N - Suite for setting up and defining backend boundaries consisting of MongoDB, Express.js, Angular2, node.js

Seeking knowledge on how the frameworks and platforms Angular 2 and Express.js collaborate in the 'mean' approach is my main query. I am interested in understanding where the client-side ends and the server-side begins. After delving into this t ...

How can I retrieve information from a MongoDB collection based on only the initial three digits?

My MongoDB collection, named pnumber, contains data that is retrieved using the db.pnumber.find() command in the mongo shell: { "_id" : ObjectId("57696e03b9c614e1143c759e"), "pnumber" : NumberLong("5037816575") } { "_id" : ObjectId("57696e03b9c614e1143c75 ...

Dealing with timing errors in React when making a POST request

My current setup involves a React file connected to an Express/Node backend and SQL database. The backend functionalities are working as expected, with all routes tested and verified using Postman. The application can successfully handle GET, POST, UPDATE, ...

Step-by-step guide on serving index.html for angularjs and other frameworks using a server

After scouring Stack Overflow and various forums without success, I finally stumbled upon a solution that worked for me. I wanted to share it here in case it helps someone else :) This solution is specifically tailored for the folder structure outlined be ...

I find myself perplexed when it comes to understanding smoke tests in the realm of

After doing some research, I understand the concept of a smoke test, but I'm having trouble grasping the real-world application. If someone could provide me with a practical example or use case, it would be immensely helpful. I am particularly confu ...

Bcrypt Error: Invalid parameters: undefined, numerical value encountered while making a POST request via the front-end

I'm a beginner in the world of nodejs and I've hit a roadblock with this bcrypt error. Interestingly, when I send a post request using postman (raw-data), everything works smoothly without any errors. However, if I try sending the request through ...

Encountering the issue of "Module build failed: Error: Cannot find module 'ajv'" can be frustrating and can disrupt your workflow

Encountering the error message Module build failed: Error: Cannot find module 'ajv' while attempting to execute vue-cli-service serve --mode dev in my application. The package ajv is installed as a dependency of other packages, and not directly ...

I encountered an issue stating, "The function `req.redirect` is not recognized."

Recently starting out with node development. Encountering the error below: TypeError: req.redirect is not a function at Post.create (/var/www/html/node_blog/index.js:40:7) at /var/www/html/node_blog/node_modules/mongoose/lib/utils.js:276:16 a ...

Retrieve the current time of day based on the user's timezone

Currently, I am working with a firebase cloud function that is responsible for sending push notifications to my app. My main requirement is to send notifications only during the day time. To achieve this, I have integrated moment-timezone library into my p ...

Developing a custom Node package in version 9.2.0 to provide compatibility with outdated Node releases

With the release of Node 9.2.0 and its new language features, I'm curious about how to develop a node module that remains compatible with older versions. For example, if I have a small module that is supported by Node 9 out of the box, like this: co ...

Steps for integrating HLS video service with Vue3.js single page application

As I work on developing a video streaming platform using Vue.js, one particular challenge has come to my attention. When utilizing single-page application (SPA) frameworks like Vue.js, JavaScript code runs on the client's browser. This means that segm ...

Collaborating with SockJS connectivity

Currently, my Node.js backend is interacting with desktop clients using websockets. The communication from the server side is initiated from a web front-end and everything is functioning properly because I am storing the SockJS Connection instances in an ...