Getting Firebase / Express / Steam Passport to work together
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I've got a route that works when I'm running my Steam Passport / Express code using a Node server, but when I try to access that route using Firebase hosting I'm getting internal server errors.

This is the route:

app.get('/auth/steam',
passport.authenticate('steam', { failureRedirect: '/' }),
function(req, res) {
res.redirect('/');
};
);

I've also got Express initialized like this:

const app = express();

And exported like this:

exports.app = functions.https.onRequest(app);

The firebase.json looks like this:

{
"hosting": {
"public": "public",
"rewrites": [
{
"source":"**",
"function":"app"
}
]
}
}

can you provide me with the js file where the above code has been implemented? Thanks
Codeword 1 month ago
Hi, I will give that tutorial a shot and let you know. Also what's the best way to share the JS file? Pastebin a link in the comments? First time using Bountify.
chriswingler 1 month ago
yes, you can share your js code in pastebin and the paste the link here.Thank you
Codeword 1 month ago
One more thing, that firebase.json file seems to be correct.That is why I provide you with the link to the tutorial, because I think there may be something wrong with the js code.Please go through the tutorial and let me know how it goes.
Codeword 1 month ago
Ok, here is the paste https://pastebin.com/sm7mXvWY . Also, following the tutorial, I'm getting this warning in Firebase project settings about tokens.. "Database secrets are currently deprecated and use a legacy Firebase token generator. Update your source code with the Firebase Admin SDK."
chriswingler 1 month ago
First of all to get an idea of what's happenning, follow the tutorial which I provided earlier, when the error comes, do one modifiaction, go to firebase.google.com and in your project , go to settings and click on database secrets and there you will see a key, copy paste the key in your code, I think this the legacy key. Let me know if this works, If any problem appears we can further continue debugging the code.
Codeword 1 month ago
Ok, just followed the instructions exactly, including the legacy key, and I'm getting a 404 error. The only change I made was adding the post request to a button in index.html. Not getting the root route in their provided server code, and if I try going to port 4000 I get a connection refused error. I tried using those firebase.json rewrite options and that didn't help either. Stuck with the default Firebase index.html and a 404.
chriswingler 1 month ago
Oh, I realized the post request button wasn't going to port 4000. Now I'm getting connection refused and Uncaught (in promise) TypeError: Failed to fetch Promise (async) auth @ (index):43 onclick @ (index):42
chriswingler 1 month ago
Another thing, when trying to deploy, I get an error "Error occurred while parsing your function triggers. TypeError: Firebase is not a constructor"
chriswingler 1 month ago
Hey chriswingler, Sorry I had been very busy with some work so couldn't respond, If by the end of this bounty nobody provide a solution, I will soon provide a working solution.So stay tuned.Thank you
Codeword 1 month ago
28 days ago

Crowdsource coding tasks.

0 Solutions