How do users log in to websites like facebook from some site that supports "share on facebook" features - facebook

I'm browsing some news sites and most of them have the option of posting the link on your facebook wall. Or retweeting it. Or to other social media sites.
How do they get the user to authenticate themselves? I just push a button and it asks me to log in, and then it creates a new post on my facebook wall.
I want to reproduce this behavior but don't know where to start.

Read the facebook information for developers here It allows you to create actions that users can do on your site like reading an article or post a photo and it will add it to their facebook profile. There is also the capability for users to register or login to your site using their facebook credentials.
Similarly go here for twitter.

These sites are all using OAuth. It basically involves the transaction of a request for an access token from the site you are logging in through. Your users validate that they approve the validity of your request by authenticating with the third party system such as Twitter or Facebook and then these systems return a token that allows you to read/write/modify user data from these sites on their behalf.

Related

How can I use Facebook Messenger Platform's webhook to subscribe to the Page messages of other users?

I am creating an application using which users will manage their Facebook messenger and post comments on a page. I have implemented the Facebook Login which asks the user for page_messaging permission. I have also configured the webhook and it is working fine.
Now, Facebook documentation states the following
Generate a Page access token to start using the platform APIs. You
will be able to generate an access token for a Page if:
You are one of the Page admins, and
The app has been granted the Page's permission to manage and access Page conversations in Messenger.
So, how can I make my webhook listen to the messages of the page that have granted me permission to manage and access the page? I have looked for hours trying to find this in the documentation. No Luck!

Link facebook messenger with facebook login on app

I have a facebook messenger bot that sends a webhook to my web app. People can login to my app via facebook login.
The first user contact is normally with my facebook bot on which they can create a profile. When they make contact I take their facebook id, name, profile pic, etc.
Users can then login with facebook to my web app to enhance their profile.
My problem is facebook uses different scoped ids for messenger and their login.
How can I recognise if a user has already been on my facebook bot if they use my web app, and vice verca.
I think it has something to do with the business mapping api: https://developers.facebook.com/docs/apps/for-business but I'm struggling to understand how it works.
I am sending a get request using:
GET /me?fields=token_for_business
But the docs do not specify the full url to use. I'm also unsure if you can use this in developer mode.
facebook provides an id-matching api
for the app and pages owned by the same business manager. More informations:
https://developers.facebook.com/docs/messenger-platform/identity/id-matching

Linking a website account to a facebook account so the user can post from the website anytime

I'm using the javascript API to link a website account to a users facebook account but I'm not sure if I'm doing it the best/easiest way.
I've created a facebook app
Used the FB.ui feed option to allow the user to post to their timeline
This works fine but the ui will ask the user to login each time they start a new session on the website. Have I missed something? Do I need to store and use the User Access Token?

Facebook API authorization - one login, multiple domains

Our application runs multiple sites for multiple customers. One service we offer is to write and post social media for our customers. We also allow the customers to do posts themselves through the application admin.
In order to facilitate the non-automated posts for customers, one of our users has access to the pages of many customers through her Facebook login.
The problem comes if she uses our application to generate an auth token through the admin area of the customer's site.
The application sends its own appID and secret key to Facebook, and the user receives the Facebook login page.
However, she used to be able to choose which page/customer she wished to log in to. Now, once the login data is submitted, Facebook immediately sends a token back to the "return URL." There's no opportunity to choose which Facebook page the auth is for.
The token appears to be linked to the user's "main" page (which is a page of ours).
Obviously, we need to be able to say "I'm logging in to Facebook page X of the many pages I'm authorized for."
Just to be clear: this is not an issue regarding authorization for our application in general. It's the specific case when the Facebook login is attached to multiple pages.
Can anyone give me some advice, please, even if it's just a link to an appropriate spot in the API docs? I've had no luck searching them.
Thanks,
Tom
Edit: First, to the question about "multiple domains": perhaps I shouldn't have put that in the title, since it's not relevant to Facebook per sé,
We host many clients who obviously have many domains. They administer their site content through a CMS which can, among other things, work with Facebook. A client often has a Facebook page; so for us at least, there is often a one-to-one correspondence between a client's site/domain and her/his Facebook page.
When someone goes through the process in question, s/he is administering the site, but may be attempting to post to a Facebook page. And one of our in-house admins has access to many clients' Facebook pages.
So let me rephrase: the admin logs in to a client's site. She attempts to authorize our application to post to that client's page. Our application sends its id/key data to Facebook, and she is taken to the login page.
The question is, how do we let Facebook know that we are seeking authorization to post to one of the many accounts/pages she can access?
Thanks for the help.
As pointed out by CBroe in the comment, if you want to post as a page, you need to have a page access token of the page that you admin. Once you have granted manage_pages permission to the app, you can call the /me/accounts edge to get the list of all pages that you admin and their access tokens.
You can then use the page access token of the page to post on behalf of the page. Note: You will need publish_pages permission in addition to be able to post on behalf of the page. Permissions are documented here.

How to contact Facebook Connect users through Facebook's API?

We have users that logged in to our website through Facebook Connect. Now we'd like to contact those users about changes as we indicated in the signup process, but we don't have their email addresses. Only their Facebook ids.
How can we contact them? I understand Facebook removed 3rd parties' ability to send notifications through Facebook's API. We can send them a message through the API either.
So I guess we're left with posting to their wall from a user account of ours. I assume there's a low limit to how often we're allowed to do that and is that even permitted? Or we can make an application request from this designated facebook user account which would show up in their notifications.
Finally, we could manually go to the user's profile page and then click the "send a message" button from our facebook user account... A lot of manual work and I assume this is frowned upon as well. Is there an easy way to find out the profile page URL from a Facebook id?
What's the best approach here where we don't break any rules?
If you are getting stream_publish extended permission in your profile then you can simply post on there wall see this http://developers.facebook.com/docs/reference/rest/stream.publish/
Alternatively this can be a better solution if the user do not granted any extended permission
http://developers.facebook.com/docs/reference/rest/livemessage.send/
you should get "offline_access" from the facebook user requests to post at anytime.