I have the following code but consistently get error 401 forbidden when attempting to run it:
func email() {
let session = URLSession.shared
let requ
You need to set the uesrname and the password.
Something like this:
request.setValue("Basic \(base64Credentials)", forHTTPHeaderField: "Authorization")
and base64Credentials
is the :
let credentials= String(format: "%@:%@", username, password)
let base64Credentials= credentials.data(using: String.Encoding.utf8)!