Log in to Facebook using username / password

Well, I searched for more than an hour on this topic and can only find OAuth solutions that I don't need or need.

I need to authenticate as I am on Facebook from a place other than Facebook. I need my site (admin zone) to authenticate to Facebook for me and post on my behalf, on my wall or the wall of my friends. This is an administration tool and I don’t want to log in to Facebook every time I post to my site. I need this extension to log in to log in and add an automatic entry with the title and image: "New message on example.com".

It seems like I searched everywhere and can only find solutions with the creation of the FB application, granting it certain rights, using oauth, etc. an overly complex process that (dare-i-say) is pretty dumb because I don’t want to authenticate other people like visitors. I just want to imitate my (my own browser), as if I'm the one who views their pages, and not an automated tool. Of course, I could probably go cURL the way and emulate the real user agent, but I'm not going to start flushing FB pages.

Is there a software-based authentication method for FB using a simple user / pass (not even stored on the server) and get the same rights that I usually get when authentication through a browser? And, of course, get the necessary data in json or other machine syntax encapsulation? I would suggest that I need to send a cookie or some form of token to susequent requests, but this is not a problem, I just need a way to authenticate with a simple user / pass and bypass this registration as a whole.

I need something similar to twitter and google +, maybe (?) I found a simple class for twitter, but there was nothing in google + (the same problem, Twitter is progressing a lot to build my application and use oauth, but they support authentication method as yourself through simple REST requests).

+6
source share
1 answer

I do not believe that there is a way to do what you describe, except for the painful and unsupported method of emulating a user agent. It is also not a good practice to do what you describe, since Facebook (and other sites for that matter) should not allow third parties to collect usernames / passwords, even if they are only on the go. I understand that in your scenario you will be the only user, but Facebook must develop its own API for the masses.

Why not set up a Facebook app and use oauth? You will only need to authorize your application once, get a network access token, and then use this access token from now on. I think this will be easier than the approach you are looking for, because you do not need to authenticate with Facebook every time. You just need an access token.

Please note that the offline access token will expire if you change your Facebook password or unauthorize your application.

+6
source

Source: https://habr.com/ru/post/898398/


All Articles