The combination of Express 3.0, Everyauth, and HTTPS creates a powerful

Currently, I am working with nodejs and using express 3 along with everyauth for google oauth.

The setup appears as follows:

everyauth.google 
/* snip */
.callbackPath('/loggedin');

var app = express();
app.configure(function(){
  /* snip */
  app.use(everyauth.middleware());
}

var server = https.createServer(sslOptions, app);
server.listen(app.get('port'), function(){
// ...
});

Upon attempting to access the google login path, an error message pops up stating:

The redirect URI in the request: http://localhost:4545/loggedin did not match a registered redirect URI

This is expected because only the httpS URI has been included in the google api console settings.

It's worth mentioning that my application solely uses HTTPS for security purposes. However, everyauth seems to replace the intended https URL with http.

I suspect this happens due to creating the https server after the app.use(everyauth.middleware()); statement. Is there a way to modify the code so everyauth recognizes the https protocol?

Could it be feasible to relocate the app.use(everyauth.middleware()); statement after setting up the https server?

Many thanks in advance!

Answer â„–1

To resolve the Facebook authentication problem, I implemented the solution below:

everyauth.facebook.myHostname('https://www.example.com')

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

Unable to access property 'name' of null object

I'm currently learning how to build a local library app using Express with The Odin Project's tutorial. Below are the relevant parts of my code: In routes/catalog.js, I have this: router.get("/books", book_controller.book_list); In models/book. ...

When sending a form with a POST request in NODE, the data can be missing

I'm having trouble with setting up routes in an API and getting data from simple forms. Take a look at this basic HTML form: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8> <title>test form</titl ...

Transfer information from the server to the client using NodeJS and Express

I am encountering an issue with sending data from my express server to the client side. I have implemented app.post and app.get, however the problem is that the request needs to originate from the client side. My requirement is to send the data from the se ...

Is it possible to exploit this specific route to gain unauthorized access to different sections of the server?

Is it possible to exploit this code to access additional server components? const downloadDirectory = './uploads/' app.get("/uploads/:id", (req, res) => { const fullFilePath = path.resolve(path.join(downloadDirectory, req.params. ...

Manipulating arrays of objects with handlebars.js

I need help with my node.js app that is returning JSON data for computers. { computers: { john: { cpu: "intel", ram: "8MB", hd: "1TB" }, jane: { cpu: "intel", ram: "12MB", hd: "500GB" }, mary: { ...

Issue with GitHub API: The "Get contents" function is consistently returning a 404 error even for valid paths

I've recently started using probot, which can be found at Currently, I am in the process of developing a GitHub application that is designed to analyze a specific .json file within a repository for any changes to date strings. To achieve this, I have ...

Is there variation in the node packages installed by various npm versions?

Node.js comes in two variations - LTS and the most current version. When utilizing npm install for package installation, is it true that the packages are installed regardless of which specific version of node.js is being used? Or do different versions of ...

Browsing data privacy is crucial, which is why I have decided to operate both servers on the same port to ensure that cookies are

In my project, the front end is built with Next.js and the backend uses Express and Node.js. These projects are currently running on different ports - the frontend on port 3000 and the backend on port 8080. While everything works fine locally and cookies a ...

Combining Watson Assistant (formerly known as Conversation) with Telegram and Facebook

I'm feeling a bit lost when it comes to connecting my Watson bot with messaging platforms like Facebook Messenger. I created the bot using the Watson Conversation service and deployed it on a Bluemix Cloud Foundry node.js app. While it's working ...

What discrepancies exist between running npm install on Windows versus Linux operating systems?

Just have a quick question to ask. I've been searching online with no luck. If I were to run npm install on a Windows machine to set up my dependencies, would it be viable to transfer the node_modules directory to a Linux machine and execute my nodej ...

The results are in from running "cypress run" - out of 332 tests conducted, 276 were skipped

It took 5 hours to complete my tests, but most of them were skipped. What could have caused this? Below are some logs and a screenshot for reference: 12 info lifecycle [email protected]~cypress:run: Failed to exec cypress:run script 13 verbose stack Er ...

Converting Buffers to Binary with JavaScript Node.js

I've been working with Node.JS Buffers to send and receive packets, but I'm struggling to figure out how to convert these buffers into binary representation. I attempted the following code snippet, but it didn't yield the expected results co ...

Detecting file changes in ExpressJS after writing data to a file.This

I'm facing an issue with my endpoints. One endpoint is responsible for writing JSON data to a static file, while another endpoint is supposed to retrieve and send that data. The problem arises when I make changes to the file but the endpoint still sen ...

What is the best way to utilize an environmental variable for storing a database password within a Node.js environment

My attempt to conceal my database password using a .env file is failing. The compiler seems unable to locate the password. You can observe the environmental variable, PWD, designated for the database password in the .env file. PWD = 0000 SECRET = mySecre ...

Auto-refresh the page upon any updates made to the MongoDB collection

I'm currently working on a Node.Js project that involves MongoDB integration. I'm looking for a way to automatically refresh one of my HBS pages whenever there is a change in my MongoDB collection. I could use some guidance on the best approach ...

Having trouble installing npm? Try running npm install lite-server -g to fix the issue

As soon as I press enter, this message appears. Modified 170 packages, and examined 171 packages in just 12 seconds There are 6 packages seeking funding. To learn more, execute npm fund No vulnerabilities were found ...

JavaScript code that retrieves an array containing only the deleted images from the information obtained from the edit product page

Currently, I am working on an edit product page in react with a node backend. The situation is as follows: Initially, the product had 4 images (a.png, b.png, c.png, d.png). I have made updates by removing the a.png image and adding a new image e.png. So ...

Using Node.js and Express.js to redirect users after a successful data insertion

I am currently developing a CRUD application in Nodejs/Expressjs using EJS as the templating engine. Within my "views" folder, I have created a subfolder named "login" which contains several .ejs files. All of my .ejs files are located within the views fo ...

The async module has already been invoked with a callback function

Below is an array that I am working with: var files = [ { name: 'myfile.txt' }, { name: 'myfile2.txt' } ]; My goal is to access these objects asynchronously and send them for extraction, as shown below: Extraction function: ...

How can we start a new session upon signing up using cookie-session and passport.js?

Currently, I have set up a /register router specifically for signing users up. In order to keep things simple right now, I am utilizing cookie-session instead of express-session. However, I've hit a roadblock when it comes to authenticating a user du ...