Reputation: 168
I am new to node.js
and I was trying to implement OAuth 2.0
with Google
using passport.js
.
I have my clientID
, clientSecret
and Authorized Redirect URLs
from Google Developer Console. The callback URL is something like http://localhost:portNumber/foo/bar/callback
and the application works perfectly when I run it from my machine.
The problem occurs when I try to access it over the Internet using a Public IP Address. I am able to access my website but as soon as I allow my application to access my Google+
profile using OAuth
it gives an error connection attempt to localhost was rejected
. It gives an ERR_CONNECTION_REFUSED error for my callback URL.
I am stuck as I do not have a domain right now to use instead of localhost
.
Kindly excuse me if my question is vague and any help would be appreciated.
P.S : I have forwarded my port.
Upvotes: 2
Views: 1644
Reputation: 15478
As suggested in my comment from above you can use localtunnel.me:
localtunnel
module on your workstation: npm install -g localtunnel
node app.js
lt --port 3000
(3000
is the port your server listens to)https://glsjjuobon.localtunnel.me
(glsjjuobon
is a randomly generated string)https://glsjjuobon.localtunnel.me/connect/google/callback
That's it! As long as your local server and the tunnel are both running you can use the generated URL from localtunnel
to access your web site.
Upvotes: 1