Meteor ROOT_URL setting to make accounts-facebook work when behind apache proxy - facebook

I'm running meteor on localhost:3000 and I have apache set up to proxy requests for a domain to that meteor instance using a virtualhost and mod_proxy.
I'm getting this error when trying to log in to my meteor app using accounts-facebook:
Given URL is not allowed by the Application configuration.: One or
more of the given URLs is not allowed by the App's settings. It must
match the Website URL or Canvas URL, or the domain must be a subdomain
of one of the App's domains.
I think this is because my ROOT_URL is http://localhost:3000 . If I change the ROOT_URL to the domain, then of course meteor tries to listen to the domain, but can't because my apache server is in the way.
Is there a way I can make this work without another IP address?

From Meteor documentation,
Ensure that your $ROOT_URL matches the authorized domain and callback
URL that you configure with the external service (for instance, if you
are running Meteor behind a proxy server, $ROOT_URL should be the
externally-accessible URL, not the URL inside your proxy).
In my case, my app is listening on a configured port with mod_proxy behind an Apache proxy server, say it is listening http://www.example.com:8080. I have other applications running on other ports.
To get going, on Facebook I set Site URL and Valid OAuth redirect URIs to http://www.example.com:3000 and App Domains to www.example.com. On my machine I set ROOT_URL to http://www.example.com:3000, which is externally-accessible.
Such configurations work for me without a second IP address.

I could get it working by simply having
# /etc/hosts
127.0.0.1 localhost.localdomain localhost
And the facebook settings as in the image below. I've set a secondary (mobile) url to point to http://localhost:3000
I've created a whole facebook app like this, with login, access to graph-api etc. And everything was working both online and in the dev envrionment

Related

We need to change our URLs without port and receive requests to the specific application

We have following URLs like
http://testserver1.com:port1
http://testserver2.com:port2
Each URL is pointing to different application on the Windows Server.
What we need to do is that we need to change the URL like http://testserver1.com instead of http://testserver1.com:port1 and it should be forwarded to the application serving port1. We do not want users to enter port number with the URL.
And if we type http://testserver2.com instead of http://testserver2.com:port2 also it should be forwarded to the application serving port2.
How can we do this with Windows Firewall - Inbound Rules and IIS. Can somebody help?
We have tried to add first Inbound Rule under Windows Firewall but we have no idea how to do the rest to forward such incoming requests to the correct application serving the specific port.

Oauth2 - Redirect url to iis on Server 2012 R2

I use Oauth2 to access a database in a cloud.
The code is developed in .net core 2.0.
The redirect urls are:
"AuthRedirectUri": "http://localhost:44378/auth/callback", "PostRedirectUri": "http://localhost:44378/myapp/Index",
I get connected to the database when the app runs on the visual studio (iis express). However, when the app is published on the local server (Windows Server 2012.R2) I receive an "invalid request" message from the third party web app. The published app is on http://localserver:80/. The solutions I have found in the web are redirecting to the localhost which doesn't work in my case.
Which hostname/port should be used to receive the callback code on the server? Shall I change anything in the iis or the server?
The solutions I have found in the web are redirecting to the localhost which doesn't work in my case.
Which hostname/port should be used to receive the callback code on the server? Shall I change anything in the iis or the server?
As far as I know, the redirect url should be your application's domain or IP address which could be access by someone outside your server.
Normally, we will use your server's public IP address and add your IIS application's port as the url(If you have the domain, you you should bind this url with domain address).
I suggest you could find this url and access from internet to make sure you could access the web application.
Then you could use this IP address and port plus sepcial fomat as the redirect url.

Using localhost for Secure Canvas URL on Facebook App

I need to develop a Facebook app, and while I request my SSL certificate, I need to start the project because I have few time to deliver it.
Is it possible to use localhost as the "Secure Canvas URL"? This field requires that the URL begins with https, so I don't know the correct way to do it (in the case that using localhost is allowed).
First of all you need to set up your server to answer HTTPS requests.
Then you create a self-signed SSL certificate – not sure if that works for the domain name localhost, but I’d recommend setting up a local domain, such as mytest.local anyway (the .local being the important part here), make your server listen to that, and your system resolve it to your local IP address, f.e. via its hosts file.
And then you tell your browser to accept that self-signed certificate … and you’re good to go.

Facebook Login API not working on localhost

I am able to interact with the Facebook Login API from my hosted web server, however when I change these settings to the localhost server I receive the message below. I have also tried adding a port number (80) but with no success. I have researched this question here on SO but it seems that I am missing something.
App Domains: localhost
Site URL: http://localhost/
Erorr: Given URL is not allowed by the Application configuration....
Add the port you are using at your localhost and you will get, you are looking for ....
like http://localhost:62024/

localhost test setup - Facebook not allowing localhost

Been trying to setup my Facebook app which I want to use for Logins to allow me to test it on my Mac's localhost. Facebook is throwing the error "App Domain: http://localhost is not a valid domain." when I try change App Domain of Site URL to localhost or 127.0.0.1
IS there any way to get the facebook login api to redirect the browser to my localhost after authentication?
The way I do it is alias the site I'm working on to something like: http://sitename.loc, and then setup an app used specifically for testing with that as the domain.
An example of how to do this can be found here:
https://stackoverflow.com/a/7493806/1056965
On your local machine you have to setup hosts file to point your site name on local ip address. For example if you have to setup authorization with fb on site example.com put this record in your hosts file
127.0.0.1 example.com
And just start your site localy and facebook oauth will redirect you on example.com and you will get valid token localy.
For setup hosts file on windows help is on this link Windows Hosts Setup
Linux help link Linux hosts
It's simple enough when you find out.
Open /etc/hosts (unix) or C:\WINDOWS\system32\drivers\etc\hosts.
If your domain is foo.com, then add this line:
127.0.0.1 local.foo.com
When you are testing, open local.foo.com in your browser and it should work.
Allready, explained here
How to Test Facebook Connect Locally