Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
CSRF Failed when POST data using Alamofire #1118
I using django-reat-framework as backend and using SessionAuthentication and TokenAuthentication. This work well when I use httpie send request
but when I use Alamofire
But 127.0.0.1:8000/api/users/ don't need any permission, and I didn't send csrf token when I using httpie. So, What's wrong here?
You probably need to use the parameter encoding
let request = Alamofire.request(.POST, URLString, parameters:parameters, encoding: .URL) debugPrint(request)
This will print out the cURL command making it MUCH easier to see what's actually going on.
In the future, I'd suggest opening a question on Stack Overflow instead. We use the GitHub project for bug reports and feature requests.
Best of luck!
From our Contribution Guidelines
We don't use GitHub as a support forum. For any usage questions that are not specific to the project itself, please ask on Stack Overflow instead. By doing so, you'll be more likely to quickly solve your problem, and you'll allow anyone else with the same question to find the answer. This also allows maintainers to focus on improving the project for others.