@Piro there are two options here, you can provide the token as a parameter or in the requests' headers. There is no specific implementation for swift. Something like so should work
// set up the base64-encoded credentials
let username = "user"
let password = "pass"
let loginString = NSString(format: "%@:%@", username, password)
let loginData: NSData = loginString.dataUsingEncoding(NSUTF8StringEncoding)
let base64LoginString = loginData.base64EncodedStringWithOptions(nil)
// create the request
let url = NSURL(string: "http://www.example.com/")
let request = NSMutableURLRequest(URL: url)
request.HTTPMethod = "POST"
request.setValue("Basic \(base64LoginString)", forHTTPHeaderField: "Authorization")
// fire off the request
// make sure your class conforms to NSURLConnectionDelegate
let urlConnection = NSURLConnection(request: request, delegate: self)
do you have CORS in place? and how are you providing the token to the controller? I am assuming you are using this package , I recommend you to refer to the docs for testing it.
just to test and learn how it works. I need to set the CORS, but i don't know how do it without a view. I want to request directly on this controller, like a ajax request.
@piro on this page there is a working example to get you started but I would do lots of readings first or you will not get much programming done! I haven't implemented CORS in L5 yet, but I found this thread taking about it. Hope that helped!