title: Facebook login app not working due to OAuthException related to app domain. (Hosted on AWS running Flask)
body: <p>We are running a small Flask based server on one of our AWS machine.</p>
  
  <p>It is currently up and running at following locations:</p>
  
  <ul>
  <li>ec2-52-37-251-245.us-west-2.compute.amazonaws.com</li>
  <li>52.37.251.245</li>
  <li>linkcuration.ddns.net</li>
  </ul>
  
  <p>However, when we click on Facebook login, we are getting OAuthException code 191. It is related to Facebook not able to find domain for the app.</p>
  
  <pre><code>{
     "error": {
        "message": "Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.",
        "type": "OAuthException",
        "code": 191,
        "fbtrace_id": "BUcMBX9EExx"
     }
  }
  </code></pre>
  
  <p>Now, we have tried multiple solutions suggested on stackoverflow including:</p>
  
  <ul>
  <li>appending URL with using xip.io</li>
  <li>getting free domain name from no-ip</li>
  <li>keeping app domain blank</li>
  <li>adding redirect URL in OAuth redirect URL</li>
  <li>Making app public</li>
  </ul>
  
  <p>Unfortunately nothing has been working so far. Facebook login and app works fine on our local machine with localhost as a server name. Issue is only while hosting server on AWS.</p>
  
  <p>We tried adding below pairs of App domain and site-URLs but none of them are working and we are also not able to find any working solution.</p>
  
  <ul>
  <li><p>OAuthException - 
  ec2-52-37-251-245.us-west-2.compute.amazonaws.com and 
  ec2-52-37-251-245.us-west-2.compute.amazonaws.com</p></li>
  <li><p>Facebook not allowing below domain saying top level domain not allowed - 
  us-west-2.compute.amazonaws.com and 
  ec2-52-37-251-245.us-west-2.compute.amazonaws.com</p></li>
  <li><p>Facebook not allowing below domain saying top level domain not allowed - 
  compute.amazonaws.com and 
  ec2-52-37-251-245.us-west-2.compute.amazonaws.com</p></li>
  <li><p>Facebook not allowing below domain saying top level domain not allowed - 
  amazonaws.com and 
  ec2-52-37-251-245.us-west-2.compute.amazonaws.com</p></li>
  <li><p>Facebook not allowing below domain saying top level domain not allowed - 
  ddns.net and linkcuration.ddns.net</p></li>
  <li><p>OAuthException - 
  linkcuration.ddns.net and linkcuration.ddns.net</p></li>
  <li><p>OAuthException - 
  xip.io and 52.37.251.245.xip.io </p></li>
  </ul>
  
  <p>Our server code is available at:
  <a href="https://github.com/karishma-sureka/museum_link_curation" rel="nofollow">https://github.com/karishma-sureka/museum_link_curation</a></p>
  
  <p>oauth.py file has OAuth related code
  <a href="https://github.com/karishma-sureka/museum_link_curation/blob/master/oauth.py" rel="nofollow">https://github.com/karishma-sureka/museum_link_curation/blob/master/oauth.py</a></p>
  
  <p>Can someone please help us what we are missing here?</p>
  
  <p>Thanks a lot!</p>