0

I am new to Django and I wanted to build a Django application that could allow users to log in using Facebook, so I have followed every step listed in this tutorial. Despite following the same step, I still getting errors after providing my password and click on the continue button. Here are two errors that I've encountered:

URL blocked

This redirect failed because the redirect URI is not white-listed in the app's client OAuth settings. Make sure that the client and web OAuth logins are on and add all your app domains as valid OAuth redirect URIs.

The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and sub-domains of your app to the App Domains field in your app settings.

My configuration for the app in Facebook developers

valid OAuth Redirect URIs: https://127.0.0.1:8000/
app domains: localhost
site url: https://localhost:8000/

I tried to search for clues everywhere but found nothing in the end. How can I make it work?

3
  • hey, you are missing information. like details of your virtual environment and packages used. but leave out info such as your secret key. Mar 12 at 16:45
  • Hi, I am using a virtual environment to run this project. I used this command line to create the venv: "conda create --name myDjango python=3.10.6". While for the package, I am using social-auth-app-django.
    – yin teh
    Mar 13 at 2:25
  • Why would you use a host name for some, and then an IP address for another of those URLs? AFAIK, this doesn't work with IP addresses at all, you must use URLs with a host name.
    – CBroe
    Mar 13 at 7:15

1 Answer 1

0

I kinda understand what is wrong now. I have a button in my web app for social authentication for facebook <a href="{% url 'social:begin' 'facebook' %}">Login with Facebook</a>. Once I've changed the link of this button to https://www.facebook.com/v9.0/dialog/oauth?client_id=your_app_id&redirect_uri=your_oauth_redirect_uri&state=yourstate_1234 (the redirect_uri in the URL should match exactly the Valid OAuth Redirect URIs in facebook app) and it worked! Here is a more detailed explanation that helped me. Btw, thanks to those who replied :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.