yin teh
yin teh

Reputation: 1

Having trouble with the authentication process of logging in Facebook from my Django project

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?

Upvotes: 0

Views: 120

Answers (1)

yin teh
yin teh

Reputation: 1

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 :)

Upvotes: 0

Related Questions