Reputation: 21
I am writing up a chrome extension. The functionality of the extension includes the Facebook login. The extension does not support external JavaScript links so for that I had to make "content_security_policy" in the manifest file of extension. And now it works, it is loading the external file of Facebook SDK. The problem I am facing now is; while creating the app in Facebook developers account, I gave the domain and URL as http://localhost.com/ and when I run SDK script on my extension it shows an error which is :
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 sub-domains of your app to the App Domains field in your app settings.
And when I load the URL it shows me the link :
chrome-extension://hpkkicffiddlopkeiobamkfhfbbofmel/index.html
By placing this URL in the Facebook developers app, it giving me invalidity error. What should I do now?
Upvotes: 2
Views: 1038
Reputation: 77541
You can't use the JavaScript SDK for OAuth logins in a Chrome extension because of this limitation - you can't redirect to an extension page.
You can use chrome.identity
API, which gives a non-chrome-extension:
virtual URL that is OK to use with Facebook. That will give you the token to use with other Facebook APIs.
There's example code here.
Alternatively, you can do the whole OAuth flow manually.
Upvotes: 2