Parse-Server Facebook login - link users with Business Mapping API? - facebook-login

I'm Using ParseServer with two different client applications. Since each mobile app is associated with a different Facebook app (different app names, logos...), the current Facebook policy is to issue a foreign user id for same users when authenticating through different Facebook apps.
We'd like to link those two user ids in ParseServer so they will share a single user account. Even when authenticating via different Facebook apps.
According to Facebook documentation the way to do that is by using the token_for_business or "Business Mapping API" to match two user IDs that belong to a single user.
However, ParseServer documentation does not indicate how to use token_for_business or "Business Mapping API".
We are currently using the /users (POST) endpoint for login and registration passing the authData structure for Facebook when Facebook auth is performed.
Assuming ParseServer uses the authData.facebook.id attribute in order to look for existing users once a new login request arrives, its possible to call the facebook API GET /me/ids_for_business and substitute the id in authData with a previously existing user id.
Is this a recommended approach?
Ideally, I'd like to just add my token_for_business to the authData in the login request and have Parse do the rest of the work. Is that supported?
Lastly, is it at all possible to link two facebook users in ParseServer? the authData structure does not seem to allow is as the "facebook" id section is no in any type of array - it seems there is no way to express dual facebook ids under a single user.. Is this changed at any future parse version (currently using Parse 1.6.14 in the client and ParseServer 2.2.19)
Thanks,
Ron

Related

Migrating existing Login flow using Instagram Legacy API to the new Instagram Basic graph API

Our application (kind-of got legacy) has been using IG API to authorize users (by using the uid attribute returned from IG's callback API response) and we have left email as an optional param (safe to assume that there are many users in the application database without email IDs persisted)
With new Instagram Basic Display API (advised), it's mentioned to use Facebook Login for authentication purpose. But I am facing a major problem of identifying existing users now (since the uid will be different).
Also I have a doubt on what will have happen for users having instagram account without linking their Facebook account to it?
I could not find a proper explanation or a documentation for seamless migration for my situation.
Please help with sharing the right resource or guidance to achieve the same.

application_id for promoted_object for AdSet of Facebook Marketing API

Question about application_id for promoted_object of Facebook Marketing API.
I'm trying to create Ads for mobile applications published to Apple App Store or Google Play Market. These are applications of my clients, they are not mine and I don't have access to them.
I have successfully created AdCampaign object with objective=MOBILE_APP_INSTALLS.
But I can't create AdSet object for this campaign.
AdSet requires promoted_object with application_id and object_store_url fields provided. While I can provide object_store_url (it's just a link to application app store page) but I can't provide application_id for this app because this application is not mine.
At the same time business.facebook.com web interface does not require application_id. It requires application_url only. Screenshots: http://take.ms/jFQyY http://take.ms/CCBGM http://take.ms/pmNap
How can I retrieve application_id using application appstore url?
Or maybe it is possible not to specify application_id field for promoted_object of AdCampaign with objective=MOBILE_APP_INSTALLS at all?
According to the Marketing API documentation for "Creating Ad Sets with Promoted Object", it says "You cannot specify an object_store_url on its own without an application_id, this is something only available via our native interfaces.".
To retrieve the application_id, you may try the Connection Objects API to get the list of connected Applications to your Ad User account. Your clients need to grant you the advertiser role to their Facebook Application first before you can start listing the applications via Connection Objects API.
Connection Objects API is able to return the object_store_urls, which means you don't need to provide the app store URL manually.

Request additional permissions only for specific users in Meteor

I have an application allowing users to sign in using their Facebook and Twitter accounts. I only need a very basic information like their email address and full name. Everything works fine and as planned.
Accounts.ui.config({
requestPermissions: {
facebook: ['email'],
github: ['user:email']
}
});
But, now I need to implement a feature posting to a Facebook page and Twitter on behalf of the admin users only. So, I need to get additional permissions from specific users only.
Admin users are eligible to manage our page at Facebook. The app needs to request additional permissions to be able to post to the page. I wan't to keep those basic permissions for regular users.
How can I accomplish that?
One way you can do is,
If you know that logged in user is Admin, put the re-authenticate button in user-dashboard (or somewhere which makes sense) that will do authentication user of user for whatever permissions as required by application.
This will basically do, oauth with social service like usual and upon completion you will get aceess code and against this code get the re-newed access token from social service. (This is normal , how you basically do the oauth manually) Now, use this access token to post to social services.
For this, you will need to use node modules such as for facebook -fb_graph , for twitter- twiiter
Hope this helps

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.

Using Graph to get a list of all my App IDs

Does anybody know if it possible to pull a list of the IDs for all the apps that I own in Facebook?
I know that each app has its own ID in the Graph (an example is here), but there doesn't appear to be connection between that and the ID of the Facebook user who created the app.
Basically, I need to script a management tool.
The app profile pages should be visible at /me/accounts when you use an access token with manage_pages permission - i'm not aware of any other way to retrieve a list of apps you admin