Accessing user_ID via messenger bot - facebook-graph-api

I'm using the Graph API, but I can't figure out how to get a logged-in users ID address.
The intro to Graph states "The Graph API can provide access to all of the basic account registration data you would typically request in a sign-up form for your site, including name, email address, profile picture, and birthday" but to access them i need user_ID so how could i get it ?

https://developers.facebook.com/tools/explorer/?method=GET&path=me%3Ffields%3Did%2Cname&version=v3.0
You need to have a token from the user, check out the given link. You can see what informations you can access if you give permission to your own profile.
This ID is unique to each app and cannot be used across different apps.

Related

Facebook Page Likes over time

I'm not the owner of a facebook page (eg. TESLA) but I'm trying to use graph api to get the number of user that liked the pages over time. Based on graphi api documentation (insight/page_fans), I'm just getting empty json documents. Any ideas how I can get this data?
Only two page-related metrics are available publicly, page_fans_country and page_storytellers_by_country.
Everything else is only accessible to an admin user of the page, resp. using a page access token.
You can not get the data you want for pages you do not have admin access to.

WSO2IS Facebook federation

It's possible to use facebook info, and get some information in the local database in the userinhfo api?
Let'me explain, I get name and mail from facebook claim, and I want the userinfo api returns that information, and local information in the local user store.
Becouse I have the user facebook email provisioned in the secondary user store, if the user is in the PRIMARY user store, userinfo works perfectly, there are some way to work with secondary user store. And my secondary user store is a custom implementation of jdbc user store.
Thanks
This is possible to do. What you can do is authenticate the user using wso2 IS. Since you use custom implementation, the claim mapping should be done accordingly. If the claims are not there create custom claims.
Try to use those claims to map the Facebook user information
Or you may want to use facebook SDK to get user information.

Is possible to use Facebook's (Page) Graph API without having an role in that page?

For example, let's say I need to "crawl" (not manually since it looks against Facebook's policies but via graph API) some information from a Facebook's brand page (e.g. https://www.facebook.com/nike/ ).
For example I may need to collect the following fields from a set of brand pages (not just one, such as the one mentioned above, for which I could definitely do it manually), when they are publicly available:
("About tab")
- description
- address
- website
- ...
I was reading Facebook's graph API docs and permissions.
However these permissions are related to users and I already worked with that. What I learned it that it works by
Facebook login --> auth the app to use my data --> the app has access to my data as a Facebook user.
However I'm now interested in brand pages for which I found this docs and this (access token). However it seems that to be able to use this access token I need to be a user with some role in the page (e.g. admin) and not any user who just liked that page.
So, is it possible to access brand pages' data (read-only, i.e. GET) via graph API without actually owning/admin/publishing on that page?
Apparently no "special" access token is required to access pages' public info.
For example I can create any page (not app) in my Facebook account and then use
GET https://graph.facebook.com/(*1)/feed?access_token=(*2)
(*1) the page's name (nike) or ID
(*2)my "bridge" page (i.e. empty page, only used to have an access token. not the page I'm using the graph api on)'s access token
Similarly for /posts/ etc.

With Google Apps Admin SDK Directory API, how can I get authenticated user id?

I have an authenticated user and am able to query for a list of domain users using the google apis php client library.
However, it is unclear to me how I can retrieve the currently logged in user's user id. I tried using the my_customer alias which works for the list method, but when I try to do the plain GET request with user key as my_customer, it of course fails.
I know this must be something quite simple, but I cannot for the life of me find an answer in the documentation, so I'm pretty much reduced to guessing at this point.
For your app to work as Google Apps marketplace app, you must implement authentication using OAUTH2.
As a result you must have access to one of the following scopes which provide the APIs that get you the user Id :
https://www.googleapis.com/auth/userinfo.profile (deprecated) : Gain read-only access to basic profile information, including a user identifier, name, profile photo, profile URL, country, language, timezone, and birthdate.
https://www.googleapis.com/auth/plus.login : If using the userId value "me", this method requires authentication using a token that has been granted the OAuth scope https://www.googleapis.com/auth/plus.login or https://www.googleapis.com/auth/plus.me.

FB G+ and Twitter integration and pushing posts

I was just wondering if an app exists for Django that helps connecting all 3 social networks, imports basic info, profile picture, but most importantly pushes the post user makes to these three website accounts. I looked into django-social-auth but that just lets you register or login with these websites,not push posts.
django-allauth http://github.com/pennersr/django-allauth/ stores basic info for FB/G/Tw (and more), provides basic access to the profile picture, and stores the access tokens in the database.
Whatever you do with the access token is project specific and beyond allauth scope. For example, in order to post to the users wall you need:
The user's permission (you can do this by configuring the proper scope for the Facebook provider, search for SCOPE in the README.txt)
Once the user is logged in via FB, the access token is stored in allauth.socialaccount.models.SocialToken. Simply lookup the token for the user that is logged in.
Then, given the token use whatever method you like to post to the Facebook API on behalf of the user. E.g. https://github.com/pythonforfacebook/facebook-sdk
For some more background on the relation between a Django user and the Social* models, see:
How can I get the user's facebook id with django-allauth?
There are django apps that do what you need individually (Facebook example), but I'm not aware of one that works with multiple.
django-social-auth will get you half way there by obtaining the users information and permission to post to the social network on their behalf.
Once you have users authenticating via django-social-auth you'll have access to the users access token needed to post to respective network on their behalf.
From there, you're going to have to stitch together some additional python modules like the Facebook example above to do the actual posting.