Hi Monks
I've written the following code to login to facebook from my website and seems to be broken
The following is fb.pl prompts to enter FB username and password. However it is failing to postback with data from the facebook pages
#!/usr/bin/perl use Facebook::Graph; use CGI; my $q = new CGI; my $APP_ID = "MY_SECRET_APP_ID"; my $SECRET = "MY_SECRET_CODE"; my $POSTBACK_URL = "http://my.own.domain.com/postback.pl"; my $fb = Facebook::Graph->new( app_id => $APP_ID, secret => $SECRET, postback => $POSTBACK_URL, ); my $uri = $fb ->authorize ->extend_permissions(qw(offline_access publish_stream email user_l +ocation)) ->uri_as_string; print $q->redirect($uri);
Postback script
#!/usr/bin/perl use strict; use HTTP::Request::Common; use CGI; use Facebook::Graph; my $APP_ID = "MY_SECRET_APP_ID"; my $SECRET = "MY_SECRET_CODE"; # # Am I doing anything wrong here by setting postback script # pointing to a different domain # my $POSTBACK_URL = "http://some.another.domain.com/postback.pl"; my $fb = Facebook::Graph->new( app_id => $APP_ID, secret => $SECRET, postback => $POSTBACK_URL, ); my $q = new CGI; my $params = $q->Vars; my $code = $params->{'code'}; $fb->request_access_token($code); my $token = $fb->access_token; $fb->request_extended_access_token($token); my $user = $fb->fetch('me'); #register data on amateur; my $login = $user->{'name'}; $login =~ s/\s//g; my %register = ( login => $login, firstname => $user->{'first_name'}, lastname => $user->{'last_name'}, email => $user->{'email'}, action => 'register' ); print $q->redirect("http://my.own.domain.com/cgi/fb.cgi?login=dummyuse +r&msg=201");
In reply to Postback URL for facebook by doubledecker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |