Facebook login, Redirect Error 500


I am trying to make facebook login works on my side: https://erp.domain.com

After login facebook, it shows me this error:

URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs.

After click on Okay, it redirects me to root site instead of the right side


Then, i try to change the domain to https://erp.domain.com/, it gives me following error:

    Traceback (most recent call last):
  File "/home/frapper/bench-repo/frappe-bench/apps/frappe/frappe/app.py", line 67, in application
    response = frappe.api.handle()
  File "/home/frapper/bench-repo/frappe-bench/apps/frappe/frappe/api.py", line 59, in handle
    return frappe.handler.handle()
  File "/home/frapper/bench-repo/frappe-bench/apps/frappe/frappe/handler.py", line 24, in handle
    data = execute_cmd(cmd)
  File "/home/frapper/bench-repo/frappe-bench/apps/frappe/frappe/handler.py", line 64, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/frapper/bench-repo/frappe-bench/apps/frappe/frappe/__init__.py", line 1071, in call
    return fn(*args, **newargs)
TypeError: login_via_facebook() missing 2 required positional arguments: 'code' and 'state'

I already added domain “https://erp…domain.com” on facebook developer.

How could i solve this issue?
Thank you.

I just figure out the facebook link button is showing incorrect, it doesn’t contain “erp”, only


Any idea how to correct it.
Thank you.

i found a way to fix, adding my side into site_config.json
thank you.

Can you explain the solution a little bit more elaborately?
What do you mean by my side?


He probably meant site.
Not sure if this is the solution, but try adding hostname to your site config.