Sabrina Leggett
Sabrina Leggett

Reputation: 9494

Facebook App on Subdomains: Site URL vs App Domains

According to facebook and other stack overflow questions, subdomains are supported in the App Domain field, however in the Site URL field (under Website with Facebook Login) they aren't. I'm creating an app for use on many different subdomains (actually chained subdomains like http://clientname.projectname.mydomain.com) that allows users to login through facebook (via js), and then retrieves their data (both through js and php).

How do you setup your facebook app so it supports multiple subdomains?

Upvotes: 16

Views: 26032

Answers (3)

Raphael
Raphael

Reputation: 1857

What worked for me was setting both the App Domains and Site URL with the site base domain (e.g. http://example.com). I could use the login in all of my subdomains.

Also, if you will use a single app for all your subdomains, check if all your subdomains are using the same App ID (this mistake stole me a few minutes of life more than once).

This also works with each subdomain having its own app (and, thus, App ID).

Upvotes: 10

salonMonsters
salonMonsters

Reputation: 1287

Our Oauth login with wildcard subdomain had been working for the last few years but then suddenly stopped a couple of weeks back.

After some trial and error I have found the following to work (at this time: sept 2017)

  • turn on ” Use Strict Mode for Redirect URIs”
  • leave “Valid OAuth redirect URIs” field blank

I'm a bit concerned that this is not a very secure setup though :( I think it will work as a temporary solution while we figure out a better way to handle it.

Upvotes: 1

Sabrina Leggett
Sabrina Leggett

Reputation: 9494

EDIT: Apparently this isn't working anymore (see comments bellow)

I just started playing around with the fields, and I think I actually found out why it wasn't working.

I must have originally left the app domain field blank, and just tried putting the domain into the Site URL field (http://example.com), which wouldn't work. Without putting in an app domain only the full url for Site URL (http://clientname.projectname.example.com) worked.

Once I put mydomain.com into the App Domain field along with http://example.com in the SiteURL field it worked with subdomains. And I had assumed the app domain field was redundant...

I guess this means I can delete the extra 20 apps I created :-)

Upvotes: 32

Related Questions