Perl - Facebook Graphics API

From time to time it was easy to distinguish between desktop and web applications, but today, while reading, while in the documentation, I noticed that this difference is less pronounced.

I use the Facebook :: Graph module to create a desktop application, but I can’t go beyond the configuration. I am stuck at the authentication stage:

my $ q = Plack::Request->new($env); $fb->request_access_token($q->query_param('code')); 

( http://metacpan.org/pod/Facebook::Graph )

He continues to tell me that "$ env is required." Reading the documentation, I realized that Plack only deals with web applications.

( http://metacpan.org/pod/Plack::Request )

Can you confirm this? If not, how do I go about this step?

It would be impossible to get access_token using Mechanize and then make a GET request, as described in the documentation, but I don't want to complicate my existence, so if there are other ways ...

+4
source share
2 answers

A bit late, but a workaround.

To get the access token, look here:

https://developers.facebook.com/docs/howtos/login/login-for-desktop/

  • Simply create a client using Mechanize or whatever you want and log in with the specified credentials

  • Run the request as described

  • Go to the login page

  • Parse the answer and get a token

  $ fb-> access_token ($ token); 
+4
source

http://developers.facebook.com/docs/reference/api/application/ says:

Note. Applications configured as desktop / desktop applications will not be able to make API calls that require an access_token application.

So this is not Plack, this is Facebook, which requires your application to be a website. But if you can avoid the access_token request, this might work.

0
source

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


All Articles