Google recaptcha v2 не получает ответ django

когда я захожу на этот сайт: https://www.google.com/recaptcha/api/siteverify, он показывает это на моем экране, как показано ниже, есть ли что-то не так с моим кодом? Нужно ли мне изменить 'g-recaptcha-response'? Я уже добавил ключ сайта и секретный ключ в settings.py

"success": false,
  "error-codes": [
    "missing-input-secret"
  ]
}

views.py

def login_user(request):
    if request.method == "POST":
        username = request.POST['username']
        password = request.POST['password']
        user = authenticate(request, username=username, password=password)
        ''' Begin reCAPTCHA validation '''
        recaptcha_response = request.POST.get('g-recaptcha-response')
        url = 'https://www.google.com/recaptcha/api/siteverify'
        values = {
            'secret': 'aaaaaaaaaaaaaaaaaaaaaaa',
            'response': recaptcha_response
        }
        data = urllib.parse.urlencode(values).encode()
        req = urllib.request.Request(url, data=data)
        response = urllib.request.urlopen(req)
        result = json.loads(response.read().decode())
        ''' End reCAPTCHA validation '''
        

        if user is not None and user.is_admin:
            request.session['userid'] = user.pk  # retrieve the user id
            login(request, user)
            messages.success(request, "You have login to the admin page")
            return redirect('home')


        if user is not None and user.is_logistic:  # # authenticated if user is a logistic
            request.session['userid'] = user.pk  # retrieve the user id
            login(request, user)
            messages.success(request, "You have login to the logistic page")
            return redirect('logistic')  # redirect the user to the logistic page


        if user is not None and user.is_customer:  # authenticated if user is a customer service
            request.session['userid'] = user.pk  # retrieve the user id
            login(request, user)
            return redirect('customer')  # redirect the user to the customer service page
        else:
            messages.success(request, "The username or password you have entered is incorrect!")
            return render(request, 'authenticate/login.html')
    else:
        return render(request, 'authenticate/login.html')

login.html

{% extends "login1.html" %}
{% block content %}
    <br><br>
    <h2 class="text-center">SCS staff login</h2>
    <hr>
    <div class="col-md-6 offset-md-3">
        <form method="POST">
            {% csrf_token %}

            <div class="form-group">
                <input type="text" class="form-control"  placeholder="Username" name="username">
            </div>
            <div class="form-group">
                <input type="password" class="form-control"  placeholder="Password" name="password">
            </div>
            <script src='https://www.google.com/recaptcha/api.js'></script>

            <div class="g-recaptcha" data-sitekey="bbbbbbbbbbbbbbbbbbbbbb"></div>
            <button type="submit" class="btn btn-primary">Log-In</button>
        </form>
    </div>
{% endblock %}
Вернуться на верх