0

I was able to access my meteor App on my mobile phone by feeding in the server IP address followed by the port. e.g. 192.168.0.106:3000. This came in very handy when demonstrating progress to my bosses.

However now that I have added and configured both Facebook & Google Accounts systems to my meteor app through:

 meteor add accounts-facebook
 meteor add accounts-google

I can only login and access my app via my computer. When I try to use the facebook login via my phones I am directed to an Error page were it says:

localhost:3000/_oauh/facebook?code=... where it says:
This site cannot be reached. Local host refused to connect. 
Try checking the connection...

and via Google login I am redirected to page:

localhost:3000/_oauh/google?sate=... where it says:
This site cannot be reached. Local host refused to connect. 
Try checking the connection...

Again just to clarify, I am able to access my app only after logging via my computer BUT not via my mobile phones anymore. Is there still a way to access the app both via my computer and mobile phones?

Thanks in advance!

SirBT
  • 1,580
  • 5
  • 22
  • 51

1 Answers1

1

The issue is with the localhost:3000. While setting up your FB App you have put the redirect URL as localhost:3000 and it is trying to redirect it to that. Unfortunately, that address is non-existent on mobile, hence, you are getting that error.

Get a domain name and point it to that IP. Then use that domain name in the redirect URL in the FB/Google app.

You have to get a domain as FB/Google will not redirect to an IP.

Ankit
  • 1,118
  • 13
  • 21
  • can I use a virtual host instead of getting a domain? – SirBT Oct 04 '16 at 14:00
  • 1
    yes. You can use ngrok.io to create a tunnel to your local host. I use it to test payment gateways. Should work for FB/Google login too. – Ankit Oct 04 '16 at 14:04
  • Would this work if I setup a virtual host instead of getting a domain? Also when I do get a domain as you suggested, what would be the next step? Am assuming I'd have to move some part of the app to the domain address? Are there any online tutorials, that can guide me on the next steps to take after getting a domain name that you know of? – SirBT Oct 04 '16 at 14:07
  • 1
    yes. this will work. This is good for testing purpose. Once you get the domain, change the settings in the fb/google apps. I am not clear what you mean by 'moving some part of the code to domain address'. You will move your app to a server and the domain will point to the ip of that server. – Ankit Oct 04 '16 at 14:49
  • Thanks I understand. Sadly the ngrok.io solution doesn't seem to work. I am able to access the meteor app via a tunnel by ngrok, but I get this error message after hitting the login button: "The redirect URI in the request, http://localhost:7123/_oauth/google, does not match the ones authorized for the OAuth client." Updating the Authorized JavaScript origins & redirect URIs to the Ngrok forwarding addresses, don't seem to make a difference. Any ideas would be great? – SirBT Oct 04 '16 at 18:01
  • The issue seems to be with your google app config: See this http://stackoverflow.com/questions/11485271/google-oauth-2-authorization-error-redirect-uri-mismatch – Ankit Oct 04 '16 at 18:34
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/124966/discussion-between-ankit-and-sirbt). – Ankit Oct 05 '16 at 08:26