Skip to main content

Debug Mode

When troubleshooting issues with OneTap Login, enabling debug mode helps identify the root cause. This guide covers how to enable logging and interpret debug information.

WordPress Debug Mode​

Enabling WP_DEBUG​

Edit your wp-config.php file (in WordPress root):

// Enable WordPress debug mode
define('WP_DEBUG', true);

// Log errors to file instead of displaying
define('WP_DEBUG_LOG', true);

// Don't display errors on screen (for production)
define('WP_DEBUG_DISPLAY', false);

// Log database errors
define('SAVEQUERIES', true);

Log File Location​

Debug messages are written to:

/wp-content/debug.log

Viewing the Log​

Via FTP/SFTP:

Download: wp-content/debug.log
Open in text editor

Via SSH:

# View last 100 lines
tail -100 /path/to/wordpress/wp-content/debug.log

# Follow log in real-time
tail -f /path/to/wordpress/wp-content/debug.log

# Search for OneTap entries
grep -i "onetap" /path/to/wordpress/wp-content/debug.log

Via WordPress Plugin:

  • Install "WP Debugging" plugin
  • View logs from admin panel

OneTap Log Messages​

Log Format​

OneTap prefixes its log messages:

[04-Jan-2024 10:23:45 UTC] [ONETAP] Message here

Common Log Messages​

Successful Authentication​

[ONETAP] Token received for authentication
[ONETAP] Token validated successfully for: user@example.com
[ONETAP] User found by email: user@example.com (ID: 123)
[ONETAP] User logged in successfully: 123
[ONETAP] Redirect to: https://example.com/my-account/

New User Registration​

[ONETAP] Token validated successfully for: newuser@example.com
[ONETAP] No existing user found, creating new user
[ONETAP] User created with ID: 456
[ONETAP] Role assigned: customer
[ONETAP] Google ID linked: 117895234567890123456

Error Messages​

[ONETAP] ERROR: Token validation failed - Invalid audience
[ONETAP] ERROR: Rate limit exceeded for IP: 192.168.1.100
[ONETAP] ERROR: Forbidden role requested: administrator
[ONETAP] ERROR: User creation failed: Email already exists
[ONETAP] ERROR: Webhook delivery failed: HTTP 500

Interpreting Log Messages​

MessageMeaningAction
Token validated successfullyGoogle auth workedGood
Invalid audienceWrong Client IDCheck settings
Rate limit exceededToo many requestsWait or whitelist
Forbidden role requestedSecurity triggeredExpected behavior
User creation failedDB or validation issueCheck details

Browser Console Debugging​

Opening Developer Tools​

BrowserShortcut
ChromeF12 or Ctrl+Shift+I
FirefoxF12 or Ctrl+Shift+I
SafariCmd+Opt+I
EdgeF12 or Ctrl+Shift+I

Console Tab​

Look for:

  • Red errors: Critical issues
  • Yellow warnings: Potential problems
  • [GSI_LOGGER]: Google Identity Services messages

Common Console Messages​

Normal/Informational:

[GSI_LOGGER]: OneTap initialized successfully
[GSI_LOGGER]: FedCM get status: OK

Errors:

[GSI_LOGGER]: Invalid origin for client: YOUR_CLIENT_ID
[GSI_LOGGER]: Missing required parameter: client_id

Network Tab​

To see OAuth requests:

  1. Open Network tab
  2. Filter by "google" or "oauth"
  3. Look for failed requests (red)
  4. Click to see request/response details

JavaScript Debugging​

Enable OneTap Debug Mode​

Add to your theme's functions.php temporarily:

add_action('wp_footer', function() {
?>
<script>
// Log Google Identity Services events
window.onGoogleLibraryLoad = function() {
console.log('Google Identity Services loaded');
};

// Log OneTap events
document.addEventListener('onetap_initialized', function(e) {
console.log('OneTap initialized', e.detail);
});

document.addEventListener('onetap_success', function(e) {
console.log('OneTap success', e.detail);
});

document.addEventListener('onetap_error', function(e) {
console.log('OneTap error', e.detail);
});
</script>
<?php
});

Check Script Loading​

In browser console:

// Check if Google library loaded
console.log(typeof google !== 'undefined' ? 'Loaded' : 'Not loaded');

// Check if OneTap initialized
console.log(window.onetapInitialized);

REST API Debugging​

Test Endpoint Directly​

Test callback endpoint:

curl -v "https://yourdomain.com/wp-json/onetap/v1/test"

Expected response:

{"status":"ok","message":"OneTap endpoint is accessible"}

Check REST API Access​

# Test general REST API
curl "https://yourdomain.com/wp-json/"

# Should return JSON with available routes

Debug REST Requests​

In WordPress, add temporarily:

add_filter('rest_pre_dispatch', function($result, $server, $request) {
if (strpos($request->get_route(), 'onetap') !== false) {
error_log('[ONETAP REST] Route: ' . $request->get_route());
error_log('[ONETAP REST] Method: ' . $request->get_method());
error_log('[ONETAP REST] Params: ' . print_r($request->get_params(), true));
}
return $result;
}, 10, 3);

Database Debugging​

Check User Meta​

-- Find OneTap-related user meta
SELECT user_id, meta_key, meta_value
FROM wp_usermeta
WHERE meta_key LIKE '%onetap%'
OR meta_key LIKE '%google%';

Check Options​

-- Find OneTap settings
SELECT option_name, option_value
FROM wp_options
WHERE option_name LIKE '%onetap%';

Via WP-CLI​

# Get OneTap settings
wp option get onetap_settings --format=json

# Get user's Google ID
wp user meta get 123 _onetap_google_id

Query Monitor Plugin​

Installation​

  1. Install "Query Monitor" from WordPress.org
  2. Activate
  3. Look for "Query Monitor" in admin bar

What to Check​

  • PHP Errors: Any errors during request
  • HTTP API Calls: External requests to Google
  • Database Queries: SQL queries made
  • Hooks & Actions: What hooks fired

OneTap-Specific Checks​

Look for:

  • Requests to oauth2.googleapis.com
  • Requests to accounts.google.com
  • Any failed HTTP requests

Email Debugging​

Check Email Sending​

If welcome emails aren't sending:

// Test email function
add_action('init', function() {
if (isset($_GET['test_email'])) {
$result = wp_mail(
'your@email.com',
'Test Email',
'This is a test.'
);
var_dump($result);
die();
}
});

// Visit: yourdomain.com/?test_email=1

Log Emails​

add_filter('wp_mail', function($args) {
error_log('[EMAIL] To: ' . $args['to']);
error_log('[EMAIL] Subject: ' . $args['subject']);
return $args;
});

Webhook Debugging (PRO)​

Log Webhook Deliveries​

add_action('onetap_webhook_sent', function($url, $payload, $response) {
error_log('[ONETAP WEBHOOK] URL: ' . $url);
error_log('[ONETAP WEBHOOK] Payload: ' . json_encode($payload));
error_log('[ONETAP WEBHOOK] Response: ' . print_r($response, true));
}, 10, 3);

Test Webhook Manually​

# Test your webhook endpoint
curl -X POST https://your-webhook-url.com \
-H "Content-Type: application/json" \
-d '{"test": "data"}'

Creating a Debug Report​

When contacting support, include:

1. Environment Information​

// Add to functions.php temporarily
add_action('admin_notices', function() {
if (current_user_can('manage_options')) {
echo '<pre>';
echo 'PHP: ' . phpversion() . "\n";
echo 'WordPress: ' . get_bloginfo('version') . "\n";
echo 'OneTap: ' . (defined('ONETAP_VERSION') ? ONETAP_VERSION : 'Unknown') . "\n";
echo 'Theme: ' . wp_get_theme()->get('Name') . "\n";
echo 'HTTPS: ' . (is_ssl() ? 'Yes' : 'No') . "\n";
echo '</pre>';
}
});

2. Recent Log Entries​

# Get last 50 OneTap log entries
grep -i "onetap" wp-content/debug.log | tail -50

3. Active Plugins​

Go to Plugins > Installed Plugins and note all active plugins.

4. Steps to Reproduce​

  1. Exact steps taken
  2. Expected result
  3. Actual result
  4. Any error messages

Disabling Debug Mode​

After troubleshooting, disable debug mode:

// wp-config.php
define('WP_DEBUG', false);
define('WP_DEBUG_LOG', false);
define('WP_DEBUG_DISPLAY', false);

Important: Don't leave debug mode enabled in production as it can:

  • Expose sensitive information
  • Slow down the site
  • Fill up disk space with logs

Next Steps​