错误 "The parameter redirect_uri is required"

Error "The parameter redirect_uri is required"

我正在使用 allauth 应用程序。但是当我尝试使用 faceook 登录时,它向我显示了一个错误 需要参数 redirect_url 但是我已经给了它一个重定向 url。Error while logging in using facebook

Redirect uri

登录码

<div style="position:absolute;left:420px;top:118px;height:400px;width:200px;" id="login">
<form method="POST" action="">
{% csrf_token %}
<label style="position:absolute;left:60px;top:50px;color:red;">Username</label>
<p style="position:absolute;left:160px;top:43px;">{{ form.username }}</p>

<label style="position:absolute;left:64px;top:111px;color:red;">Password</label>
<p style="position:absolute;left:160px;top:103px;">{{ form.password }}</p>

<input  style="position:absolute;left:210px;top:163px;height:36px;width:80px;background-color: #c52d2f;border-radius: 6px;color:white;" type="Submit" value="Login"/>
<a style="position:absolute;left:64px;top:171px;font-size:15px;font-weight:800;" href="{% url 'new' %}">Reset Password</a>
<a href="https://www.facebook.com/dialog/oauth?client_id={{ 198608780589573 }}&amp;scope={{ scope }}&amp;redirect_uri="{{ "http://127.0.0.1:8000/about_us" }}">Login using Facebook</a>
</form>
</div>

{{ var }} 是 Django 模板语言,用于将变量从视图函数传递到您的 html。请将您的代码更改为...

&redirect_uri=127.0.0.1:8000/about_us

在 href 标签中尝试此代码:

<a href="https://www.facebook.com/dialog/oauth?client_id=198608780589573&amp;scope={{ scope }}&amp;redirect_uri='http://127.0.0.1:8000/about_us'">Login using Facebook</a>

您错误地使用了 {{ }} 大括号。如果有 Django 变量,那么只有你应该使用 {{ }},否则只用双引号就足够了。