Authentication

Sending log entries to the API requires basic auth through HTTPS.

Basic Authentication

For  Basic Authentication a Base64 encoded header consisting of username and a password is required:

  • username: App ID
  • password: App Secret

The App ID and App Secret you get when you create a new app in the SwiftyBeaver Mac App. On success the request returns status 200. If wrong credentials are used then the HTTP status 401 is returned.


Example in Swift (NSMutableURLRequest):

// request object<br>let request = NSMutableURLRequest(URL: serverURL)
request.HTTPMethod = "POST"
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("application/json", forHTTPHeaderField: "Accept")
<br>// basic auth header
let credentials = "\(appID):\(appSecret)".dataUsingEncoding(NSUTF8StringEncoding)!
let base64Credentials = credentials.base64EncodedStringWithOptions([])
request.setValue("Basic \(base64Credentials)", forHTTPHeaderField: "Authorization")

Still need help? Contact Us Contact Us