Using Twitter for user authentication in Heroku: "can’t establish a connection to the server at 127.0.0.1:8080" - node.js

I am following this scotch.io tutorial on twitter node authentication to authenticate users on a Heroku app. I have made my callback URL this: http://127.0.0.1:8080/auth/twitter/callback
I am able to click on a link to authenticate the user but then and it says "can’t establish a connection to the server at 127.0.0.1:8080"
No useful clues in the logs. I believe I have set up all my routes and .js files properly, as laid out in the tutorial, and am not sure what could be causing this problem.

Related

I'm getting a redirect_uri_mismatch when deploying my Node.js app to Heroku using Google OAuth2

I'm tasked with making a server using Node.js which will read emails from a Google account and parse the content from those emails into data we can store in a database. I'm using Google's googleapis package (v103.0.0) in NPM to authenticate/authorize with whichever account we'd like to use.
The issue comes when we try to switch accounts and have the user re-auth. During development on a local machine, the Auth process works as expected:
The client requests an Auth URL.
The server generates a new Auth URL and sends it back to the client.
The client redirects to that URL and the Google Consent Screen is shown.
The client is asked to choose between logged-in Google accounts.
The client authorizes the application and is redirected back to the server with a code.
The server uses the code to generate/save a token, which allows it to use the Gmail API.
However, after deploying to Heroku, the Google Consent Screen no longer allows the user to select an account. Instead, at step 3, it shows this message. In just about every other question related to this error, there's always additional information below the error code/message, but nothing's there for me. I made sure: (1) the domain I'm using in Heroku is verified on the Google Cloud Console, and (2) the redirect_uri within the Node.js application is passing the correct domain to the Auth URL, even while in production.
I can't provide the URL for privacy reasons, but let me know if there's any source code or Cloud Console info I should include.
It didn't take long after posting this question, but I realized I was using an incorrect OAuth 2.0 Client ID type. I was attempting to use "Desktop" when I should've been using "Web application" instead. Take a look at this image to see the difference.
When you select "Web application", you're given some new options: Authorized JavaScript origins, and Authorized redirect URIs. This is where you need to fill out the allowed URIs. Here's a sample of what that should look like.

How to create a node js application with vue js as frontend and postgres as backend

I would like to know the folder structure of NodeJs as server side VueJs and postgres as back end
As my requirement is we will register user (not from external site ) we will create the user
After authentication authorized user can use web service or content
most important user authentication. which authentication method should use
I have read about passport it is using for authentication between various external site
I have read number of topics i could not found suitable, please guide me
summaries the requirement
folder structure of node
user authentication
NodeJs and VueJs connection
open source

Facebook login in parse after migration

I completed all the steps of migrating from parse to my local server windows server 2012R2 deployed mongoDB and the parse server and the node.js and python on the server and of course installed the webserver role on the window.
I am now successfully listening to port 1337 for connections and I connected my node.js to the mongoDB and also accepted connections successfully to the database via port 27017. Entered my new app keys and client keys and updated them on my application. But my application has facebook login. And for sure when I open the app to login it gives me an error in the console saying "facebook auth is not configured". Ordinary user login is working but the Facebook one is not.
I think there was a way that I can add my facebook app ID to the nodejs index file where I updated all the keys. But I really don't know how to do it. If any body has experience in deploying parse on his own web server please advise.
Thanks.

Phonegap Facebook authentice in server side using expressjs and passportjs

I built a web server using nodejs and expressjs where authentication is done using passportjs.
I now want to build a mobile application using phonegap and of course use my existing web server to query for data.
I need to authenticate my users using Facebook connect on my server and only then the session is created and I can query my API.
I searched a lot for a solution and found nothing. I looked at InAppBrowser and ChildBrowser but I don't think they will do the trick as I need to keep the session alive in order to query the api.
Any help would be appreciated
Thanks

Unable to keep a peristent login with the oauth2orize provider using ExpressJS

I'm working on creating an app that will provide authentication using the OAuth2 protocol to serve known clients using the app's Strategy.
I have tried using both the oauth2orize, and node-oauth2-provider modules, and I keep getting the to same point:
User logs in through client, api key and api secret are verified, and the user can successfully log in through my provider app.
After the client app, and the user successfully authenticate, a token is sent back to the client app (user is logged in the client - yay!), but the user is immediately logged out on the Provider app. I cannot figure out where, and why this happens - is this a feature of the OAuth2 protocol?
Is this normal? If I use Facebook as a strategy (think passport-facebook), then if I log in to any app using Facebook, I am still logged into Facebook when I'm redirected back to the app - this is the behavior I want to provide clients accessing my app.
Both Provider modules are great at doing 90% of what I'm looking for, but neither provide the "persistent" login in their examples, oauth2orize, and node-oauth2-provider. Am I missing something?
Um, I think I got it.
I was running both the client and server on localhost, using different ports - and cookies/sessions were overwriting each other.
So if client express app was running on http://localhost:3000 and oauth provider was running on http://localhost:3001, logging into the oauth provider and creating a session on the client was overwriting the session on the provider.
Solution (for now):
# /etc/hosts
127.0.0.1 dev.client.com
127.0.0.1 dev.oauth-provider.com
Logging in to http://dev.client.com:3000 takes me to http://dev.oauth-provider.com:3001 and when a user successfully logs in and a session is created on client, provider is still logged in.

Resources