Using facebook with the standard PHP example

i am reposting this question from an earlier post since the nature of the question has changed.

it appears FB is supposed to log in using the standard code below but i am getting an error (below). i should think that the code SHOULD NOT need to be modified at all since i am able to log in successfully using both google and auth0. suggestions?

<?php

session_start();  // necessary ?????????????

require 'vendor/autoload.php';
use Auth0\SDK\Auth0;

$auth0 = new Auth0([
  'domain' => 'dXXXXXXXXXX.auth0.com',
  'client_id' => 'LXXXXXXXXXXX',
  'client_secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'redirect_uri' => 'https://XXXXXXXXXX.site/auth0/index.php',
  'persist_id_token' => true,
  'persist_access_token' => true,
  'persist_refresh_token' => true,
]);

$userInfo = $auth0->getUser();

if (!$userInfo) {
                                                //echo '<a href="login.php">Log In</a>';
        $auth0->login();
    // We have no user info
    // See below for how to add a login link
} else {
        printf( 'Hello %s!', htmlspecialchars( $userInfo['name'] ) );
    // User is authenticated
    // See below for how to display user information
}

here is the error i see when trying to use FB (note that google and oauth work fine with the php script above)

[Wed Oct 16 20:43:47.480765 2019] [php7:error] [pid 20488] [client 13.56.32.142:52059] PHP Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: GET https://dev-y-wc5m4m.auth0.com/userinfo resulted in a 429 Too Many Requests response:\nToo Many Requests\n in /var/www/html/auth0/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113\nStack trace:\n#0 /var/www/html/auth0/vendor/guzzlehttp/guzzle/src/Middleware.php(66): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))\n#1 /var/www/html/auth0/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response))\n#2 /var/www/html/auth0/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)\n#3 /var/www/html/auth0/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}()\n#4 /var/www/html/auth0/vendor/guzzlehttp/promises/src/Promise.php(246): GuzzleHttp\Promise\TaskQueue->run(true)\n#5 /var/www/htm in /var/www/html/auth0/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113

Hi edwardsmarkf :wave:

No error in your code here: Auth0 is returning a 429 Too Many Requests error. It seems you’re a little too excited in sending requests over and have hit a rate limit. Wait a bit and it should be fine again.

If you need to know more about rate limits, check this part of the docs

1 Like

i am sorry but i do not understand. my example is here:

https://featherstester.site/auth0/index.php

Both Auth0 and Google work fine, but not Facebook. and i have not tried again with FB for at least 24 hours now, so i dont understand how i could be up against any sort of limit. please advise.

what is the “Valid OAuth Redirect URIs” value i should be using for facebook? i am using:

https://dev-y-yc5m4m.auth0.com/login/callback

per: this page but i am now thinking that may be incorrect.

here is my code:

<?php

session_start();

require 'vendor/autoload.php';
use Auth0\SDK\Auth0;

$auth0 = new Auth0([
  'domain' => 'dev-y-wXXXXXX.auth0.com',
  'client_id' => 'LXXXXXXXXXXXXXXX3',
  'client_secret' => '2tXXXXXXXm',
  'redirect_uri' => 'https://featherstester.site/auth0/index.php',
  'persist_id_token' => true,
  'persist_access_token' => true,
  'persist_refresh_token' => true,
]);

$userInfo = $auth0->getUser();

if (!$userInfo) {
                                                //echo '<a href="login.php">Log In</a>';
        $auth0->login();
    // We have no user info
    // See below for how to add a login link
} else {
        printf( "Hello %s!", htmlspecialchars( $userInfo['name'] ) );
    // User is authenticated
    // See below for how to display user information
}

re-framing question here

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.