I'm facing a problem in Facebook Oauth Login.
When trying to login with Facebook (OpenAuth) in my website, I have encountered with this error.
Condition 1: If i try to Login with URL www.medimart.com.np/sf/sfLogin.aspx . Login is successful and everything is working fine.
Condition 2: But if i try to Login with URL medimart.com.np/sf/sfLogin.aspx. Login is failed and I get Error Message:
"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."
How can i fix this issue?
Facebook always check for the WWW domain. So make sure that www.medimart.com.np is working on your browser.
You have to edit your hosts file here:
C:\Windows\System32\drivers\etc
And add below lines:
127.0.0.1 medimart.com.np
127.0.0.1 www.medimart.com.np
See How to Modify your hosts file.
A link shared from the Ermir 's comment.
There are two camps on the subject of the www subdomain. One believe it should be enforced (www.yes-www.org) and the other (no-www.org) that it should be removed. They are both right.
What's important is that there is only a single canonical address to your website – with or without www.
Your server needs to have the URL Rewrite module installed. Chances are that it does already. Azure Websites does and so does all of my other hosting providers.
Use below rule for the domain without WWW:
<rule name="Remove WWW" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{CACHE_URL}" pattern="*://www.*" />
</conditions>
<action type="Redirect" url="{C:1}://{C:2}" redirectType="Permanent" />
</rule>
Use below rule for the domain with WWW:
<rule name="Enforce WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{CACHE_URL}" pattern="^(.+)://(?!www)(.*)" />
</conditions>
<action type="Redirect" url="{C:1}://www.{C:2}" redirectType="Permanent" />
</rule>
Now you can add above rule in web.config file:
<system.webServer>
<rewrite>
<rules>
<!-- Add your rules here -->
</rules>
</rewrite>
</system.webServer>