User not found, or token is not authorized in R - r

Getting likes from facebook using following command
x <- getLikes(XXX, token=token)
XXX is the user ID of facebook account of person and token is created by Graph API Explorer.
Using this command, I find like activity of user and user's friend account. Out of 10 friends, I got the following Error for some users
likes <- getLikes(XXX, token=token)
Error in getLikes(XXX, token = token) :
User not found, or token is not authorized.
I create new token also but still I get same Error.
Please tell me what should I do to resolve this.

While authorizing a user are you enabling extended permissions as true?
If not, then you have to enable extended permissions as follows
fbOAuth(app_id="Your_app_id",app_secret="your_app_secret",extended_permissions=TRUE)
Once you do this the getLikes function should work properly for all users

It isn't working for you because facebook has stopped the service. Unless the user that you are requesting details from authorizes your application, you wont be getting the data

Related

My user has granted all permissions for authentication scopes to google calendar, but the API is returning a 403 error?

My user has granted all permissions for authentication scopes to google calendar, but the API is returning a 403 error. However, this only happens for some users. Most user do not have any problem.
I reviewed this live with the user as they granted access and can confirm that they did grant access to all the scopes but the issue still persists.
When you are accessing an api endpoint that requests privet user data you must be authorized to access that data. You haven't posted your code or stated which method you are trying to use but as an example lets look at
Events.list in order to use this method the documentation tells us that you need to authorize the user with one of the following scopes
If you authorize your application with a difference scope and not one of these you will get the error message you are seeing Insufficient authentication scopes.
The key to fixing this will be to fix your code to ensure that you are sending the proper scopes, then to revoke the users access and force the system to prompt the user for consent again. The user must see the consent screen again showing the new scope required. Once the user has authorized with the new scope it will work.
It is probably running on an old access token and refresh token without prompting the user for authorize again.
The insufficient scopes means that the user has authorized your application bu

OneDrive Webservice - Can different users access my OneDrive?

i want to implement a REST webservice in my wordpress blog. Visitors or other users can select images from my OneDrive Account and order them.
My problem is when i get the authentication code i must enter my password für OneDrive. After that i get the access_token. The access_token has only a runtime for 1 hour.
When i order i new access_token the code is expired and i must get a new authentication code with my user password.
How i can implement a webservice for OneDrive without enter my own password everytime?
Thanks for your help.
When you get the access_token through the code flow when authing you should also see a refresh_token come back (provided you requested the wl.offline_access scope). You should be able to use that to get a new access_token by using the this process without requiring user interaction.

Instagram API Bad request

I have a web application allowing users to login by their instagram account.
I've registered my app to Instagram.
When the user clicks the login button, I direct him to instagram page to login:
https://instagram.com/oauth/authorize/?scope=basic+relationships&client_id={MyClientId}&redirect_uri={My call back aspx page}&response_type=token
After getting access token, I try to get user's followers by sending a GET request to this link:
https://api.instagram.com/v1/users/201199350/follows?access_token={The access token i've got from the previous step}
For my account (which is the account the application registered with) it works perfect.
But the problem occurs when I try to get the 'follows' from other account.
I get 'Bad request 400' error.
How can I solve this issue?
Thank you !!
This is unsolved issue because error 400 means, that user not allowed or not found (deleted by spam/bot system). Also you cannot get followers of private user, if an authentication user is not follower of him.
For the authentication users from first link you can use https://api.instagram.com/v1/users/self/follows?access_token={The access token i've got from the previous step} link.

facebook offline_access error

to access users info when they are offline,
the user grants offline_access and I store them by this :
$session=$facebook->getSession();
if($session)
{
$access_token=$session['access_token'];
}
$qq=sprintf("insert into `tokens`(`uid`,`access_token`) values ('%s','%s')",$myid,$access_token);
$res1=mysql_query($qq);
but when I try to use graph.facebook.com to collect information from them , it sometimes work and some times doesn't and gives me this error :
Error validating access token: Session does not match current stored session. This may be because the user changed the password since the time the session was created or Facebook has changed the session for security reasons
i use graph.facebook.com/[function]?access_token=[the access token saved in DB]
what's my fault?
First, the access token with the offline_access permission can become invalid if :
the user de-authorizes your app in his privacy settings
the user changes his password
You can read a blog post from Facebook about how to handle expired tokens.
Then, you should not :
make API urls directly with URLs, like you do when you call graph.facebook.com/[function]..., but use the Facebook PHP SDK functions to make API calls.
use the version of the PHP SDK you are using ($facebook->getSession() is from v2.x) is deprecated, that might be the causes of your problems.
Here is an answer on Stackoverflow about how to handle offline_access access tokens with the Facebook PHP SDK v3.x.
Hope that helps !

Facebook Graph API and friend's email

There are some question on the StackOverflow about facebook & email, but after reading them I still have a problem with retrieving users emails.
Our app implemented on Flex and uses REST API. And previously it used notifications.sendEmail.
App has publish_stream and email permissions (checked with users.hasAppPermission).
I tried users.getInfo for get proxied_email address.
But this function does not return email address of the friend..
Then I performed the following test using Graph API and web browser:
Opened the following link for authorization with extended permissions:
https://graph.facebook.com/oauth/authorize?client_id=[app_id]&scope=publish_stream,offline_access,email&redirect_uri=http://www.facebook.com/connect/login_success.html
It returned code for retrieving access_token
Oppened the following link for retrieving access_token
graph.facebook.com/oauth/access_token?client_id=[app_id]&client_secret=[secret]&code=[code]&redirect_uri=http://www.facebook.com/connect/login_success.html
It returned access_token. And now I can use GraphAPI.
Tested with my account
graph.facebook.com/me?access_token=[token]
Ok. It returned my emal.
Tested with my friend
graph.facebook.com/[friend_id]?access_token=[token]
And here is no email field!
So my questions are
Where did I go wrong?
Is it possible to get friend's email via Facebook API (GraphAPI or REST API)?
Thanks.
Email permission gives access to your email only.
If you look at the extended permissions page it says:
Likewise, to protect the privacy of users who have not explicitly authorized your application, your application will only be able to access the basic profile information about a user's friends, like their names and profile pictures. If your application needs to access other data about a user's friends to enable social functionality, you will need to request some of the special friends permissions listed below.
And if you look at the table below, it says "not available" for email permission for friends.
there ought to be some way else how does JanRain does it?
http://www.janrain.com/products/engage/invite-friends
I think that getting friends' email ids is not permitted by Facebook; at least, that's what my research tells me.
#helloworld: Who told you that janrain gets users' friends' email ids?
Only with the extended permission you can specify via the scope attribute, when obtaining the access token
Example:
https://graph.facebook.com/oauth/authorize?
client_id=...&
redirect_uri=http://www.example.com/callback&
scope=email

Resources