Как авторизовать android-приложение в django-rest-framework?

Есть url для авторизации через rest, но даже там запрашивается csrfmiddlewaretoken. Соответственно, простая передача логина и пароля не работает.
<form method="post" role="form" action="/api-auth/login/">
              <input type="hidden" value="KLJVW0Zf1CXOaBrG4mp3NVrf7AJHw9iO" name="csrfmiddlewaretoken">
              <input type="hidden" value="" name="next">

              <div class="clearfix control-group " id="div_id_username">
                <div class="form-group">
                  <label for="id_username">Username:</label>
                  <input type="text" value="qwe" required="" id="id_username" class="form-control textinput textInput" autocorrect="off" autocapitalize="off" maxlength="100" name="username">
                  
                </div>
              </div>

              <div class="clearfix control-group " id="div_id_password">
                <div class="form-group">
                  <label for="id_password">Password:</label>
                  <input type="password" required="" id="id_password" class="form-control textinput textInput" autocorrect="off" autocapitalize="off" maxlength="100" name="password">
                  
                </div>
              </div>   
                  <div style="border: none" class="well well-small text-error">Please enter a correct Email and password. Note that both fields may be case-sensitive.</div>
                
              

              <div class="form-actions-no-box">
                <input type="submit" id="submit-id-submit" class="btn btn-primary form-control" value="Log in" name="submit">
              </div>
            </form>


Нужно ли отключать csrf защиту или есть способ авторизовать при помощи токена?
  • Вопрос задан
  • 803 просмотра
Пригласить эксперта
Ответы на вопрос 1
DmitryVoronkov
@DmitryVoronkov
Python Developer
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы