Chrome Extension with Facebook: redirect_uri problem
I am writing a Chrome extension using FB apis but this simple code:
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
开发者_JAVA技巧function login()
{
FB.login(handleLogin);
}
function handleLogin(response)
{
//if a user fails to log in...
if (!response.session)
{
document.write('Failed');
return;
}
//searching users by the name of mike
//FB.api("/search?q=mike&fields=name,picture&type=user", handleSearch);
}
//the API key of the application, change it to yours
FB.init({ apiKey: 'c4a22dc0e8dc317cd80618bb9556e34d' });
</script>
won't be executed with the error
API Error Code: 191 API Error Description: The specified URL is not owned by the application Error Message: redirect_uri is not owned by the application.
I don't have a website nor I'm trying to link facebook to a website, I just want to create a chrome extension for my friends to use (like a little widget which would display contacts news)
Any idea on how to solve this?
See this: http://developers.facebook.com/docs/authentication/ and look for the section called Desktop Apps in the bottom.
You need to use this Url for dekstop apps:
https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=https://www.facebook.com/connect/login_success.html
You have have the success URL be one that is on your server, and have your extension run a content script on that URL. You can then use the chrome APIs in your content script to save the access token somewhere.
精彩评论