You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

如何修复Facebook URL加载错误?Hybridauth库登录域名问题求助

Fixing "Can't load URL: The domain of this URL isn't included in the app's domains" for Hybridauth Facebook Login

Hey there! Let's work through this Facebook login error you're hitting with Hybridauth—this is a super common misconfiguration issue, so we'll get it sorted quickly. Here's what to check step by step:

1. Verify App Domains in Basic Settings

First, head to your Facebook App's Basic Settings (the first screenshot you mentioned):

  • Locate the App Domains field. You need to add every domain and subdomain your app uses here—without adding http:// or https:// prefixes. For example:
    • If your app runs on example.com, add example.com
    • If you have a subdomain like app.example.com, add that too
  • Make sure you don't include trailing slashes or port numbers (unless you're using a non-standard port for local development, like localhost for localhost:8000)

2. Double-Check Valid OAuth Redirect URIs (Critical!)

This is the most often missed step. Go to Facebook Login > Settings in your app's product settings (your second screenshot):

  • Find the Valid OAuth Redirect URIs field. You must paste the exact callback URL that Hybridauth uses to send users back to your app after Facebook authentication.
  • To find this URL:
    • Check your Hybridauth configuration file (usually config.php or similar) for the callback parameter under the Facebook provider
    • Or, look at the full error URL in your browser—you'll see a redirect_uri parameter that shows the exact URL Facebook is trying to use
  • Ensure the URL includes the correct protocol (http:// or https://), full domain, and path (e.g., https://yourdomain.com/hybridauth/facebook/callback)
  • Save these changes—this field is case-sensitive and must match perfectly

3. Confirm Site URL (For Web Apps)

Back in Basic Settings, check the Site URL field:

  • This should be set to the root URL of your application, like https://yourdomain.com/
  • Facebook uses this to verify that your app's domains are legitimate, so it needs to be accurate

4. Clear Caches and Retest

After updating all settings:

  • Click the Save Changes button in Facebook Developer Console (don't skip this!)
  • Clear your browser's cache, or use an incognito/private window to test the login flow—old cached settings can sometimes prevent new changes from taking effect
  • Also, double-check that your Hybridauth configuration for Facebook has the correct redirect_uri set (if you're specifying it manually) to match what you entered in Facebook's settings

5. Local Development Notes (If Applicable)

If you're testing on localhost:

  • Make sure your Facebook app is set to Development Mode (under App Status in Basic Settings)
  • Add localhost to App Domains, and your local callback URL (like http://localhost:8000/hybridauth/facebook/callback) to Valid OAuth Redirect URIs
  • Avoid using 127.0.0.1 instead of localhost unless you explicitly add that domain too

Once you've gone through these steps, the error should disappear. Let me know if you run into any snags with the specific settings!

内容的提问来源于stack exchange,提问作者tariq ali

火山引擎 最新活动