Created a test user: username: "david" password: "framework"

let urlString = "http://gemcave.pythonanywhere.com/api/order" let email = "david" let password = "framework" let parameters = [ "username": email, "password": password ] Alamofire.request(.GET, urlString,parameters: parameters).responseJSON {response in let json = JSON(response.data!) let swiftyJsonVar = json["truckType"].string print(swiftyJsonVar) } 

Error: return nil - authentication fails I don’t know what the problem is in the server or application

Backend: Django Rest Framework

JSON example:

 [ { "id": 1, "textDep": "Paris", "textDest": "Deli", "truckType": "Грузовик1", "created_date": "2015-12-22T09:42:38Z", "author": 1 }, { "id": 4, "textDep": "Astana", "textDest": "Almata", "truckType": "Грузовик1", "created_date": "2015-12-22T09:44:13Z", "author": 1 } ] 

enter image description here

    1 answer 1

    I can assume that you did not activate the test user, try to raise django-admin, and from there you can already check if there is a user, if he is active, if he has the appropriate permissions, everything will become clear from the server.