I want to send a message to my facebook page using my user credentials and using ngrok to make a localhost tunnel so that facebook can reach my machine. However I am still getting a bad request (500) telling me I havn't registered any domains or supdomains.
On developers.facebook.com I have something like this in my App domains: 04cda25e.ngrok.io
and I have this in my site Url https://04cda25e.ngrok.io/
This is my code:
//https://stackoverflow.com/questions/13376710/facebook-app-domain-name-when-using-localhost Ik krijg badrequest omdat ik geen appdomain opgegeven heb
public void postToFacebook(){
FacebookConnectionFactory connectionFactory =
new FacebookConnectionFactory("1783242201976620", "******");
OAuth2Operations oauthOperations = connectionFactory.getOAuthOperations();
OAuth2Parameters params = new OAuth2Parameters();
params.setRedirectUri("https://04cda25e.ngrok.io/1234");
//appid:1783242201976620 <<<<< not really an appid
//apptoken:Ycics4TEiCAs9JZXyHD4I489D6M <<<< this is like a mock apptoken. Totally not a real one that's for sure...
params.setScope("public_profile,email,user_birthday");
// upon receiving the callback from the provider: http://massapi.com/method/an/andExpect.html
AccessGrant accessGrant = oauthOperations.exchangeCredentialsForAccess("*****", "****",params);
Connection<Facebook> connection = connectionFactory.createConnection(accessGrant);
Facebook facebook = connection.getApi();
//facebook.pageOperations().
facebook.feedOperations().updateStatus("I'm trying out Spring Social!");
}
It throws the 500 error at the point where I'm trying to get the accessgrant.
Can someone please help?
EDIT: Heres a screenshot taken from my facebook settings: https://pasteboard.co/GXjfojs.png
Anyone have a clue on what I should change?