Github/facebook & php

hi Konrad -

As a newbie, this really was very confusing and time-consuming. the example “quick-code” generated in “Configure Auth0 PHP SDK” does not include the scope.

here are the results i am seeing:

AUTH0: with scope:

Hello !array(3) { [“sub”]=> string(30) “auth0|5d9ca5804c5a1c0e1ea2b0fa” [“email”]=> string(20) “mark@domain.com” [“email_verified”]=> bool(true) }

AUTH0: without scope:

Hello mark@domain.com!array(7) { [“sub”]=> string(30) “auth0|5d9ca5804c5a1c0e1ea2b0fa” [“nickname”]=> string(4) “mark” [“name”]=> string(20) “mark@domain.com” [“picture”]=> string(122) “https://s.gravatar.com/avatar/15e7770737e26d7094f3c77d76b2dbe0?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fma.png” [“updated_at”]=> string(24) “2019-10-29T15:34:01.287Z” [“email”]=> string(20) “mark@domain.com” [“email_verified”]=> bool(true) }

FACEBOOK: with scope:

Hello !array(3) { [“sub”]=> string(24) “facebook|568242963910810” [“email”]=> string(32) “mark@gmail.com” [“email_verified”]=> bool(true) }

FACEBOOK: without scope:

ERROR! This page isnt working dev-y-wc5m4m.auth0.com redirected you too many times.

GOOGLE: with scope:

Hello !array(3) { [“sub”]=> string(35) “google-oauth2|114113878629589347134” [“email”]=> string(20) “mark@domain.com” [“email_verified”]=> bool(true) }

GOOGLE: without scope:

Hello Mark Edwards!array(11) { [“sub”]=> string(35) “google-oauth2|114113878629589347134” [“given_name”]=> string(4) “Mark” [“family_name”]=> string(7) “Edwards” [“nickname”]=> string(4) “mark” [“name”]=> string(12) “Mark Edwards” [“picture”]=> string(83) “https://lh3.googleusercontent.com/a-/AAuE7mAK2vXecQCbEYKvoz5q7J8LP8YUAkswlsY36P5kYg” [“gender”]=> string(5) “other” [“locale”]=> string(2) “en” [“updated_at”]=> string(24) “2019-10-29T15:28:01.605Z” [“email”]=> string(20) “mark@domain.com” [“email_verified”]=> bool(true) }

GITHUB with scope:

Hello !array(2) { [“sub”]=> string(14) “github|2924002” [“email”]=> string(22) “mark@domain.com” }

GITHUB without scope:

ERROR! This page isnt working dev-y-wc5m4m.auth0.com redirected you too many times.

MSN with scope:

Hello !array(3) { [“sub”]=> string(28) “windowslive|a2cd40fdb7dbcb5b” [“email”]=> string(26) “makr@domain.com” [“email_verified”]=> bool(true) }

MSN without scope:

This page isnt working dev-y-wc5m4m.auth0.com redirected you too many times.

here is the code i am using (below). i am still wondering why including the scope fixes all the problems but i cannot extract name, picture, etc ??

$auth0 = new Auth0([
  'domain' => 'dev-y-wc5m4m.auth0.com',
  'client_id' => 'LXXXXXXXXXXXXX3',
  'client_secret' => '2XXXXXXXXXXXXXXXXXm',
  'redirect_uri' => 'https://DOMAIN.com/auth0/index.php',
//'scope' => 'openid email name nickname picture',  //needs to be included for facebook, github, and msn
       
  'persist_id_token' => true,
  'persist_access_token' => true,
  'persist_refresh_token' => true,
]);

error_log('index.php:  NOW trying to get userInfo.');

$userInfo = $auth0->getUser();

error_log('index.php:  $userInfo: ' . print_r($userInfo,1));

if (!$userInfo) {
error_log('logging in:');
                                                //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 {
        error_log('We have userInfo ');
        printf( "Hello %s!", htmlspecialchars( $userInfo['name'] ) );
var_dump($userInfo);
    // User is authenticated
    // See below for how to display user information
}

i know many people who would not have stuck with this and identified the issue! could you please find out for me why why the scope is not returning picture and name?? :relaxed: