Open nivek1385 opened 6 years ago
quite the same issue, I'm still blocked, my problem is: facebook no longer accepts http redirect address, but only https, and there is no way to change facebook behaviors, perhaps from cambridge analytica scandal. I bypassed it copying and pasting the address from terminal to browser and changing the redirect address from http to https, process goes on, and try to push the code to https://localhost:3333 but the script waits on http port, so, on browser window, I have to change https with http and the script receives the code, but when it tries to excange it with a token, the process stops and exit, as nivek wrote.
Looks like facebook-cli will need to be updated to use HTTPS during the authentication handshake.
Unfortunately, I currently don’t have a computer to work on. Maybe somebody in the community would like to try to solve this?
See, for me, switching it to https for the facebook URL and then switching the local URL to http worked. The problem then was that the login timed out and it doesn't give me an option to log back in.
Correction, I was confusing this with the npm fbcli tool. Oops. I CAN switch it to https for the facebook URL and then switch the local back to http, and it acts like it was successful, but it doesn't actually save.
It looks like I got it working...it's a pain in the neck, but here's the workaround:
https://graph.facebook.com/v2.12/oauth/access_token?client_id={yourappid}&redirect_uri={your redirect URL with port AND TRAILING SLASH}&client_secret={yoursecretid}&code={the part after the code= in the URL from running the login command}
For example, run facebook-cli login and you get the output
Open this URL in a web browser and allow access to the Facebook Graph on behalf of your user account:
https://www.facebook.com/dialog/oauth?client_id={yourappid}&redirect_uri={redirect URL}&scope=user_likes,user_friends,user_posts,user_photos,user_videos,user_events,publish_actions
Waiting to receive authorization code on port 3333...
Copy the URL into your browser and adjust the redirect to have https instead of http. It'll redirect to something like "http://192.168.1.5:3333/?code={gibberish} So, you'd take {gibberish} and insert it above in place of "{the part after the code...}"
That will return an access token and associated info which you'll just need to copy into your ~/.facebook-clirc file without the quotation marks.
DONE ! great job! Two only advises, just to help, redirect_uri has to have https:// address (I use https://localhost:3333) and when you copy the token in ~/.facebook-clirc, have to delete the { }, the quotation marks and all the rest after the end of the code, and it need one space between colon and the code like this: access_token: kjwdfuqwgewgwrqgwrqkwuw455436/&%7 now i can post on my timeline but not on my page...but this is one other story, I think it's a problem of permissions for API pages that need special auth from facebook.
update: I'm able to post on my page, maybe it's clear, but the problem was that i received access token for my user, then i went to Graph API explorer and retrieve the token for my page, after changed it in ~/.facebook-clirc, everything went well, so, yes, with some tricks we arrived to the end! THANK YOU SPECIOUS AND NIVEK !
G;ad I could help with the workaround until someone more knowledgeable can help with changing the http to https.
Works for me. Just make sure Enforce HTTPS
is set to No
for your app, under Products > Facebook Login
.
Suspect new users are having this problem because, per Facebook documentation:
All new apps created as of March 2018 have this setting on by default and you should plan to migrate any existing apps to use only HTTPS URLs by March 2019.
@specious: It might be worth updating the Facebook setup section of README.md to reflect this change by Facebook.
(And it’s good to know there’s a deadline for when HTTPS will become necessary.)
I am in awe of the creativity you guys have demonstrated here in this thread.
I've returned from hiatus, with ginormous thanks to @btrask for bestowing upon me one of his personal laptops for me to be able to work on. You guys should definitely check out his github projects!
I upgraded facebook-cli login
to use HTTPS to listen for the auth code and updated the initial setup instructions, which are now accurate and decidedly much simpler (495d96c3fa4347da4ad652067bb73947e9c0e951). I also pared down facebook-cli's functionality in light of the recent slew of deprecations to the Graph API (d66a192fee35cb29c690e94e28ca27b78a5465c7). Certain features now require a formal application review, which regrettably puts facebook-cli users on the sidelines.
Functions removed are:
facebook-cli 1.7.1 is now in rubygems and ready to go.
I've tried the facebook-cli login and it seems successful (```Waiting to receive authorization code on port 3333...
Received authorization code. Exchanging it for an access token...
``) but then whenever I try to do anything else such as facebook-cli me or facebook-cli friends, I get an error message stating that I need to login:
Obtain an access token to interact with the Facebook API.Run: facebook-cli login`