"(#200) Requires extended permission: publish_checkins" while permission is granted - facebook

I'm trying to make checkin with facebook sdk from iOS app and getting the following error.
Something wrong with the error description because user granted my app with the extended "publish_checkins" permission and it is mentioned in current session variable below:
Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x1cd94430 {com.facebook.sdk:HTTPStatusCode=403, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 200;
message = "(#200) Requires extended permission: publish_checkins";
type = OAuthException;
};
};
code = 403;
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x1e05f9c0, state: FBSessionStateOpenTokenExtended, loginHandler: 0x0, appID: 592414770811425, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x1e05fa80>, expirationDate: 4001-01-01 00:00:00 +0000, refreshDate: 2013-08-09 00:21:49 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
"publish_checkins",
"user_about_me"
)>}
Please advice,
Thanks!

It is turned out that "publish_checkins" permission is not supported now. I wasn't even able to add this permission at Facebook application configuration page (App Settings -> Permissions)
Now I post to timeline with place id and it works just fine (you have to ask for "publish_stream" instead of "publish_checkins" permission).
Thanks!

Related

Connecting to Facebook's API

I am facing this issue connecting with Facebook's API using httr package, while testing on 'me' node I came along the following problem.
I was under the impression that me node does not require special permissions.
Testing on the browser with 'https://graph.facebook.com/me' gave the same results, it would be great if some one could provide an explanation.
# Define keys
app_id = 'my_app_id'
app_secret = 'my_app_secret'
# Define the app
fb_app <- oauth_app(appname = "facebook",
key = app_id,
secret = app_secret)
# Get OAuth user access token
fb_token <- oauth2.0_token(oauth_endpoints("facebook"),
fb_app,
scope = 'public_profile',
type = "application/x-www-form-urlencoded",
cache = TRUE)
response <- GET("https://graph.facebook.com",
path = "/me",
config = config(token = fb_token))
# Show content returned
content(response)
$error
$error$message
[1] "An active access token must be used to query information about the current user."
$error$type
[1] "OAuthException"
$error$code
[1] 2500
$error$fbtrace_id
[1] "ARRnb93rZHmWLlXK_MMJlfi"
Noting that I have signed in using the app.

Salesforce making REST calls using access token uses local host rather instance url

I am using a ionic app and have implemented oauth using forcejs described here https://github.com/ccoenraets/forcejs/blob/master/README.md
my code looks like below:
getContacts(){
let service = DataService.getInstance();
service.query('select id, Name from contact LIMIT 50')
.then(response => {
let contacts = response.records;
console.log(JSON.stringify(contacts))
});
}
login(){
let oauth = OAuth.createInstance('mycousmerappid','','http://localhost:8100/tabs/tab1');
oauth.login().then(oauthResult => {
DataService.createInstance(oauthResult);
console.log("Logged Into Salesforce Successfully:::" + JSON.stringify(oauthResult));
this.getContacts()
});
}
the oauth token instance url and refresh token all comes up in login but get contact throws error as below
zone-evergreen.js:2952 GET http://localhost:8100/tabs/services/data/v41.0/query?q=select%20id%2C%20Name%20from%20contact%20LIMIT%2050 404 (Not Found)
scheduleTask # zone-evergreen.js:2952
scheduleTask # zone-evergreen.js:378
onScheduleTask # zone-evergreen.js:272
core.js:9110 ERROR Error: Uncaught (in promise): XMLHttpRequest: {"__zone_symbol__readystatechangefalse":[{"type":"eventTask","state":"scheduled","source":"XMLHttpRequest.addEventListener:readystatechange","zone":"angular","runCount":8}],"__zone_symbol__xhrSync":false,"__zone_symbol__xhrURL":"http://localhost:8100/tabs/services/data/v41.0/query?q=select%20id%2C%20Name%20from%20contact%20LIMIT%2050","__zone_symbol__xhrScheduled":true,"__zone_symbol__xhrErrorBeforeScheduled":false,"__zone_symbol__xhrTask":{"type":"macroTask","state":"scheduled","source":"XMLHttpRequest.send","zone":"angular","runCount":0}}
at resolvePromise (zone-evergreen.js:797)
at resolvePromise (zone-evergreen.js:754)
at zone-evergreen.js:858
at ZoneDelegate.invokeTask (zone-evergreen.js:391)
at Object.onInvokeTask (core.js:34182)
at ZoneDelegate.invokeTask (zone-evergreen.js:390)
at Zone.runTask (zone-evergreen.js:168)
at drainMicroTaskQueue (zone-evergreen.js:559)
at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:469)
at invokeTask (zone-evergreen.js:1603)
based on link i am not expecting it to use the base url localhost. Please advise how to fix this issue
i dont know how to resolve the same way but then i used direct http rest format using the accessToken and instanceUrl coming from oAuth. That works just fine

post comment on facebook error: An unexpected error has occurred. Please retry your request later

I get an error when I post a comment in my post:
code Koala:
Koala.config.api_version = "v2.0"
#graph = Koala::Facebook::API.new(access_token)
comment = #graph.put_comment(params[:comment][:id_ref_facebook], params[:comment][:content])
code FB_graph:
post = FbGraph::Post.new(params[:comment][:id_ref_facebook])
bool = post.comment!(
:access_token => access_token,
:message => params[:comment][:content]
)
I get this error:
message: An unexpected error has occurred. Please retry your request later. [HTTP 500]
The comment is posted in facebook, but the unique ID of the comment is not returned.

Facebook Connect error: 1000

I get this following error when I am trying to integrate the fbconnect to my app.
I tried everything possible, but the error still continues.
Can anyone help me, thanks in advance.
2012-04-05 19:46:05.805 YBGreetings[12264:17603] yes granted
2012-04-05 19:46:17.035 YBGreetings[12264:17603] received response
2012-04-05 19:46:17.036 YBGreetings[12264:17603] Err message: (null)
2012-04-05 19:46:17.037 YBGreetings[12264:17603] Err code: 10000
2012-04-05 19:46:17.038 YBGreetings[12264:17603] Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x9131c90 {error={type = mutable dict, count = 3,
entries =>
2 : {contents = "type"} = {contents = "OAuthException"}
3 : {contents = "message"} = {contents = "An active access token must be used to query information about the current user."}
6 : {contents = "code"} = 2500
Extract from error log:
An active access token must be used to query information about the current use
So while doing query, consider to include access token

Google authentication

I got a problem on google authenticate, it worked for a month but since a few days I got this error :
Fatal error: Uncaught exception 'apiAuthException' with message
'Invalid token format' in /home/project/html/google/auth/apiOAuth2.php:127 Stack trace:
#0 /home/project/html/google/auth/apiOAuth2.php(89): apiOAuth2->setAccessToken('{? "access_tok...')
#1 /home/project/html/google/apiClient.php(132): apiOAuth2->authenticate(Array)
#2 /home/project/html/hk/connects/google.php(22): apiClient->authenticate()
#3 {main} thrown in /home/project/html/google/auth/apiOAuth2.php on line 127
In apiOAuth2.php I have the code :
$accessToken = json_decode($accessToken, true);
if (! isset($accessToken['access_token']) || ! isset($accessToken['expires_in']) || ! isset($accessToken['refresh_token'])) {
throw new apiAuthException("Invalid token format");
}
I noticed that google doesn't send me the $accessToken['refresh_token'].
It doesn't seem to come from google cause I did a correct connexion on http://stackoverflow.com
Maybe it's cause of my code :
session_start();
$client = new apiClient();
$plus = new apiPlusService($client);
if (!isset($_GET['code'])) {
header('Location: '.$client->createAuthUrl()); // Calls the same page
} else {
$client->authenticate(); // Fails at this level
}
EDIT:
I figured a way to do it, like I don't know what is refresh_token made for I added this line :
if (!isset($accessToken['refresh_token'])) $accessToken['refresh_token'] = 12345678910;
It works for the moment...
There is a new explicit parameter called "access_type" required by the google authentication api to obtain a valid refresh token.
With this parameter you declare that you need offline access to the account and the api provides you a refresh token.
Download the latest google PHP SDK that automatically handles the new required parameter