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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.