Thursday, February 10, 2011

facebook api key problems php

I get an invalid API key which is definitly correct- no whitespaces or nothing- im stuck

Fatal error: Uncaught exception 'FacebookRestClientException' with message 'Invalid API key' in /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebookapi_php5_restlib.php:3112 Stack trace: #0 /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebookapi_php5_restlib.php(309): FacebookRestClient->call_method('facebook.auth.g...', Array) #1 /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebook.php(206): FacebookRestClient->auth_getSession('c6b7baef6d609ba...', false) #2 /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebook.php(167): Facebook->do_get_session('c6b7baef6d609ba...') #3 /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebook.php(68): Facebook->validate_fb_params() #4 /home/maxer/domains/follor.com/public_html/xmasapp/index.php(15): Facebook->__construct('?99a8a43434baf7...', '?02365dce6ae555...') #5 {main} thrown in /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebookapi_php5_restlib.php on line 3112
  • error comes from the code i pulled from the facebook demo app- for the initialisation of the facebook object-

    the quotes should be double quotes and not single quotes for the api key and secret

    $api_key = "bla";
    

    instead of

    $api_key = 'bla';
    
    Mark : I didn't downvote this, but double or single quotes makes absolutely no difference unless you have some `$`s in your key.
    From chris

0 comments:

Post a Comment