<?php require_once 'auth0/vendor/autoload.php'; require_once 'auth0/src/Auth0.php'; require_once 'auth0/vendor/adoy/oauth2/vendor/autoload.php'; require_once 'auth0/client/config.php'; use Auth0SDK\Auth0; $auth0 = new Auth0(array('domain' => $auth0_cfg['domain'], 'client_id' => $auth0_cfg['client_id'], 'client_secret' => $auth0_cfg['client_secret'], 'redirect_uri' => $auth0_cfg['redirect_uri'])); $token = $auth0->getAccessToken(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title><?php wp_title(' - ', true, 'right'); ?> </title> <meta name="description" content=""> <meta name="author" content=""> <?php wp_head(); ?> <script type="text/javascript"> var ajaxUrl = "<?php bloginfo('wpurl'); ?> /wp-admin/admin-ajax.php"; </script>
}); // Get the user info from auth0 $userInfo = $auth0->getUserInfo(); $fitbitIdentity = $userInfo['identities'][0]; if ($fitbitIdentity['provider'] != 'fitbit') { die('The provider is not fitbit'); } ?> <h1>User info from auth0</h1> <pre> <?php var_dump($userInfo); ?> </pre> Access Token: <?php echo $auth0->getAccessToken(); ?> <br/> Id Token: <?php var_dump($auth0->getIdToken()); ?> <br/> <?php require_once 'OAuthSimple.php'; $oauthObject = new OAuthSimple(); // The oauth credentials takes information from the configured application and information of the user, that // we get from auth0 $signatures = array('consumer_key' => $fitbit_cfg['consumer_key'], 'shared_secret' => $fitbit_cfg['consumer_secret'], 'oauth_secret' => $fitbitIdentity['access_token_secret'], 'oauth_token' => $fitbitIdentity['access_token']);