I have an application which syncs user data from source to destination.
Current Use case: Sync Facebook photo to dropbox.
I have implemented following steps to retrieve user photos:
Take user access token; then exchange it with extended access token.
Save the extended access token to DB.
Poll to Facebook on Timeline Photo album with the help of extended access token and using lastSync check to check if new photo is present.
If there are any new photos available, then get those photos and upload them to user's Dropbox account folder (assuming that we have Oauth permissions for user's Dropbox account). Finally update lastsync in DB as currect timestamp.
My new use case is to get Facebook posts/photos with criteria like if n number of comments are posted to a photo/post; then retrieve it and sync it to Dropbox. In this case; it can be a old post or photo too.
I tried it with Real-Time update subscription but it didn't helped me much.
Any help on the above use case will be very helpful.
BTW, I am using Restfb.
Related
I need to check whether the provided blob is assigned to the organisation represented by tenant ID.
Provided information is:
- storage URI
- SAS token
My solution is to list all the subscription within the organisation, get the subscription of provided blob and find the match.
The problem is, in Azure SDK i can not find any method to get information about subscription.
The only way I can list the properties about my storage account is to use azure CLI by running command
az storage account show
Is there any way to get subscription information having such parameters?
If not, could you suggest me some solution to check blob belongingness?
In your case, you need to have the permissions for all the subscriptions in the tenant(e.g. you are the owners of the subscriptions).
My workaround is to call the REST API Subscriptions - List in java(seems there is no sdk to list subscriptions), to call the rest api in java, you could refer to this link.
Then List resource groups in every subscription, after that you can List all storage accounts in a resource group. Then check the storage account if exists in them.
Could you recommend me some other solution to confirm blob belongingness? Maybe I need more input data? If so, what kind of data?
First, your purpose is a reverse search, so we could not know the subscription, resource group. So we could not know the details about the storage account, like the resource id of the storage account, becasue the resource id includes the subscription id and resource group name. So even if you have other input data, which is not related to the storage account directly, we just could use the workaround above.
Does anyone has some experience with this?
I was trying to find some tutorial for basic operations at least, I found only RestFb java docs, which is not very descriptive.
What I need: getting Instagram user by Id, searching of posts / users by search word, getting users posts, managing posts (publish, unpublish),...
From what I got from the API documentation is that Instagram account is bound to a Facebook page and I need a user access token of the user that has some role at that page.
When I want to get a Facebook user I create a DefaultFacebookClient with the access token and call fatchObject, but what should I create when I want Instagram data?
Thanks very much for any answer.
I think you still need to get the Page object with facebookClient.fetchObject and then get the IgUser object with
IgUser igUser = page.getInstagramBusinessAccount();
keeping in mind that the fetchObject will have to list as parameter fields the Instagram fields as well (e.g., instagram_business_account), like for example:
Page page = facebookClient.fetchObject("fb_page_name", Page.class,
Parameter.with("fields", "id, name, username, about, fan_count, engagement, talking_about_count, picture, website, instagram_business_account"));
hope this helps.
I want to create a tool wich allow a user to post his planning on several media at once : he has to fill a form with his establishment week planning, then I post it via newsletter, on his facebook and on his website.
I am struggling with the facebook part. I created an app and made the page subscribe to this app then I tried to use Facebook4j to post something on the page but I am not even able to get the page.
Here is my code :
Facebook facebook = new FacebookFactory().getInstance();
facebook.setOAuthAppId("{app_id}", "{app_secret}");
facebook.setOAuthPermissions("public_profile, manage_pages, publish_pages, publish_actions");
facebook.setOAuthAccessToken(new AccessToken("app_id|app_secret", null));
try {
ResponseList<Account> accounts = facebook.getAccounts();
} catch (FacebookException e) {
e.printStackTrace();
}
which always return me the error :
An active access token must be used to query information about the current user.
How can I have an active access token in order to post on pages which suscribed to my app?
NB : I am not sure I actually need an app. If there is an other way to post on multiple pages without asking for logging each time, I am ok with that too. (some kind of permanent page token maybe?)
Thanks!
Okay first, yes you need an app to perform these requests.
To get what you describe you are requesting the permissions needed correctly, you still miss one - namely pages_show_list.
In addition you have to set the OAuthAccessToken to the users token not to the app token.
I have an webapp which has a facebook log in and once a user logs in I store the user's access token in my db. I also have subscribed for user feed using realtime api. So when ever user adds a status or comments I would get callback from fb. This would just tell me that there is a change(I don't get the id of the comment or status). So I have to query the graph api with the stored access token to get the feed and see what are the things that are updated. So if I see that there is a new comment after the last query I had made, I would process it.
Is there any way to get the id of the comment or status that was made
by the user?
And I the access token that I get expires in an hour. So I can't query for data when there is a user update callback after an hour. I also can't ask the user to go to my app again and re authorize, since he won't use that app after log in(I just need him to log in to my webapp so that I can get his access token).
Is there any way to get the access token without the user having to
go through the authorization phase again(This is because user won't
come to my app again after he logs in, we just poll for his fb
activities)?
Thanks
I'm developing an app that uses OAuth to authenticate.
The problem is that when I try to get the access_token from facebook with passport.js (node.js) I get something different that when I try to get it with Scribe on Android. Is there any reason?
When I try with twitter the access token are the same and I can match users....
Thanks!
Unless I misinterpreted the question, you can use the "id" field in the response from FB to detect whether its the same user or not (regardless of which API/language you end up using). These IDs are unique per user and should allow you to detect whether the same user logged on via Android (Scribe) or passport.js (node). Hope it helps