::setCredential($cred) calls that // you see in the samples. $cred = new OAuthTokenCredential( $configManager->get('acct1.ClientId'), $configManager->get('acct1.ClientSecret')); /** * ### getBaseUrl function * // utility function that returns base url for * // determining return/cancel urls * @return string */ function getBaseUrl() { $protocol = 'http'; if ($_SERVER['SERVER_PORT'] == 443 || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')) { $protocol .= 's'; $protocol_port = $_SERVER['SERVER_PORT']; } else { $protocol_port = 80; } $host = $_SERVER['HTTP_HOST']; $port = $_SERVER['SERVER_PORT']; $request = $_SERVER['PHP_SELF']; return dirname($protocol . '://' . $host . ($port == $protocol_port ? '' : ':' . $port) . $request); }