🔧 How to Fix "Requests from referer <empty> are blocked"

This error occurs when your Google API key has HTTP referrer restrictions that don't allow requests from localhost. Here's exactly how to fix it:

1️⃣ Go to Google Cloud Console

Navigate to: https://console.cloud.google.com/apis/credentials

Make sure you're signed in with the same account that created the API key.

2️⃣ Find Your API Key

Look for your API key in the list. It should end with ...P9pJEE

Click the EDIT button (pencil icon) next to your API key.

📸 What you should see: A list of API keys with "Key restrictions" and "Creation date" columns
3️⃣ Edit Application Restrictions

Scroll down to the "Application restrictions" section.

You'll see it's currently set to "HTTP referrers" with some restrictions.

Option A: Quick Fix (Recommended for development)

Change the restriction type from "HTTP referrers" to "None"

This removes all restrictions and allows the API key to work from anywhere.

Option B: Add Localhost (More secure)

Keep "HTTP referrers" and add these entries:

localhost
localhost:8000
http://localhost
http://localhost:8000
http://localhost:8000/*
4️⃣ Save Changes

Click the "SAVE" button at the bottom of the page.

Google needs 2-3 minutes to apply the changes.

5️⃣ Test the Fix

Go to: http://localhost:8000/check_api_key.php

This will test if your API key restrictions are now fixed.

⚠️ Important: Wait 2-3 minutes after saving before testing. Google needs time to propagate the changes.
6️⃣ Try Your Sudoku Solver

Once the test passes, try your AI mode:

🤖 Open AI Mode

Upload an image and it should work!

🔒 Security Note:
For development, using "None" restrictions is fine.
For production, consider adding specific domain restrictions instead of allowing all referrers.

🚨 Still Having Issues?

If you still get errors, try these diagnostic tools:

Need help? The diagnostic tools will give you specific error codes and solutions.

← Back to Main Menu