FQL query error: "An unknown error has occurred." - android

I've started facing some problems with Facebook FQL without any change to my code. And they're also getting solved without any change!
I'm receiving this annoying message that has no clear indication of the problem and possible solutions.
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1
}
}
I've been using FB-SDK for Android and changed it to parse content from url (GET) and the problem still existing.
I'm trying to trigger this simple query (that works in the Graph API Explorer).
SELECT name,price_range,type,location,page_id FROM page WHERE page_id in (SELECT page_id,latitude,longitude FROM place WHERE distance(latitude, longitude, '-30.03852', '-51.17877') < 50000 LIMIT 20) AND (type='RESTAURANT/CAFE' OR type='LOCAL BUSINESS')
The url used is the following
https://graph.facebook.com/fql?q=SELECT name,price_range,type,location,page_id FROM page WHERE page_id in (SELECT page_id,latitude,longitude FROM place WHERE distance(latitude, longitude, '-30.03852', '-51.17877') < 50000 LIMIT 20) AND (type='RESTAURANT/CAFE' OR type='LOCAL BUSINESS')&access_token=ACCESS_TOKEN
Any help??

Your query works fine. I suggest to Log your active session token and make sure it is open when running query. You can check then state of session by using isOpened method
activeSession.getState().isOpened()
best of luck :)

Related

Googlesheet with Flutter : invalid_grant Invalid JWT

So, I've spent the past 2 hours searching for a solution for this but I cannot get anywhere.
I've followed this link to setup the google sheet API in order to use it with Flutter.
I keep getting this error:
ServerRequestFailedException (Failed to obtain access credentials. Error: invalid_grant Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values in the JWT claim. Status code: 400)
As far as I've seen, this is related to a time problem but I've made sure the device's time is correct + enabled auto setting in the settings.
I'm using an android emulator (Pixel 4 API 27)
These are 2 pictures to show my time settings:
My code: (I'm calling the initSheet() in main)
class SpreadSheet {
static late final gsheets;
static late final spreadsheet;
static Future<bool> initSheet() async {
// TODO: Handle errors (Wrong time....)
gsheets = GSheets(_credentials);
/// link looks like so https://docs.google.com/spreadsheets/d/YOUR_SPREADSHEET_ID/edit#gid=0
/// [YOUR_SPREADSHEET_ID] in the path is the id your need
spreadsheet = await gsheets
.spreadsheet("1t51H_CSHPFoKB7KW_AcGMi3gwyJnecfM_k5wvk4OQ04");
return (spreadsheet == null ? false : true);
}
}
Somehow, the code is running perfectly now.
I used flutter clean & had to re-download gradle-6.9 zip because it got corrupted somehow.
I still don't know if that's exactly what actually fixed it or no but it'll be worth the try if someone faces this problem again.

Facebook Graph API - Android - URL comment count is wrong

I have read this "Facebook comment-count always showing 0" but it isn't my case.
I use graph API for android to count number of comments on a url link. Just look a simple example:
1 - Use graph explorer: Press this. You will see the result is "comment_count": 47 at this time, and a line "id": "https://developers.facebook.com/docs/plugins/comments/" that content the link we count.
2 - But when I use android facebook graph to query the link like this:
String linkt = "https://developers.facebook.com/docs/plugins/comments/";
String graphLink = "/v2.2/?format=json&fields=share{comment_count}&id=" + linkt;
I got the result {"id":"https:\/\/developers.facebook.com\/docs\/plugins\/comments\/?format=json","share":{"comment_count":0}}
Do you see the "?format=json" was automatically added to my url. So the result is always 0. Because it a wrong url.
Thank you for all help.
I added "&" after my link to separate with "?format=j", then it worked.

get large picture from facebook page

I spent the last 5 hours trying to get large picture from Facebook page using this request:
https://graph.facebook.com/v2.1/Y.Anti.coup.D?fields=name,picture?type=large&access_token=CAAHH9uJXXOcBA
But I always get this error:
{ "error": {
"message": "Syntax error \"Expected end of string instead of \"?\".\" at character 12: name,picture?type=large",
"type": "OAuthException",
"code": 2500 } }
Sorry for my bad English, and I hope that you understand my problem.
You can do this a lot easier:
https://graph.facebook.com/page-id/picture?type=large
(no Access Token needed btw)
In your case, the problem is that you are using the question mark two times. This is how your code should work:
https://graph.facebook.com/v2.1/Y.Anti.coup.D?fields=name,picture&type=large&access_token=CAAHH9uJXXOcBA

facebook graph api 601 exception. getting exception in the graph api

I'm new to graph API... I'm running the FQL query in the graph API
SELECT name, FROM user WHERE uid = me()
I'm getting this error...
please help me.. thanks in advance
{
"error": {
"message": "(#601) Parser error: unexpected 'monthly_active_users' at position 0.",
"type": "OAuthException",
"code": 601
}
}
SELECT name FROM user WHERE uid = me()
remove the coma after name
if you want to add more selection add coma
like this
SELECT name,id FROM user WHERE uid = me()
this video link might help you better understandign in fql
link

Phonegap facebook plugin for android gives me an oauthexception

seriously going insane here....
I'm trying to get the phonegap facebook plugin for android to work, but it's really driving me up the wall (no pun intented).
I am using the code from https://github.com/irnc/phonegap-plugin-facebook-connect/tree/oauth-2.0+irnc, at least I think I am.
I appear to have two problems:
the following callback in the login (from pg-plugin-fb-connect) gives an error because "FB.Auth.setAuthResponse(response.authResponse, response.status);" cannot be found. Am I using an incorrect facebook sdk? Apparently no, see edit below
PhoneGap.exec(function (response) {
console.log('PG.FB.login.success: ' + JSON.stringify(response) + ', store into localStorage ...');
localStorage.setItem(key, JSON.stringify(response));
FB.Auth.setAuthResponse(response.authResponse, response.status);
if (cb) {
cb(response);
}
}, null, service, 'login', ['publish_stream', 'read_stream']);
},
When I comment the FB.Auth.setAuthResponse(response.authResponse, response.status); statement, my login returns successfull! I get an authresponse with an accesstoken and status set to connected. When I try to execute the following code (on success callback)
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
console.log(JSON.stringify(response.error, null, 4));
alert('We are very sorry, but somthing went wrong');
} else {
alert('Message was successfully posted to your wall!');
}
});
it gives me an oauthexception message: "An active access token must be used to query information about the current user."
I authenticated with 'read_stream, publish_stream' permissions.
These two are probably related, but I can't find anything about the setAuthReponse call in the facebook api.
EDIT help is apparently not on it's way, but i've continued my quest to get this to work.
The facebook js sdk I got from the github repo's are all using the 'old' auth methods. I've downloaded the new facebook js sdk and FB.Auth.setAuthResponse is there. I copied the code to my existing js sdk and changed all calls to setSession to setAuthRepsonse. Everything is working fine, except that the access token doesn't appear to be posted when I make above FB.api calls. After these changes, the error remains exactly the same!
Oh yeah, I also changed the check in the login callback to check for authResponse instead of session (it's in the example).
Help is more than welcome,
rinze
I think I fixed this. Basically the ConnectPlugin.java is still returning a "session" response object instead of the "authResponse" that the new SDK expects.
See https://github.com/odbol/phonegap-plugin-facebook-connect/commit/0ef84e29603338930ff82fc6d6ef8525b668077d for details.

Categories

Resources