Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Get JSON data from Server swift Alamofire

When I want to get data from the server using Alamofire it shows me some error I want to get data from the server using the header in my header I pass id and token.

    let BEARER_HEADER2 = [
        "authorization":AuthService.instance.authToken,
        "id": AuthService.instance.userEmail
    ]
    print(BEARER_HEADER2)

    Alamofire.request("http:...../api/v1/user/profile",method: .get, encoding: URLEncoding.default, headers: BEARER_HEADER2).responseString
        {
            response in
        switch response.result {
        case .success(let value):
            let swiftyJson = JSON(value)
            print(swiftyJson)
            print("Khabbab")

        case .failure(let error):
            debugPrint(response.result.error as Any)
            print ("error: \(error)")
        }
    }

["id": "128", "authorization": "$2y$10$3qRkxh6RPwtsCaVtADWy2.lVTpfY/OY4.4eRLxvSNJMS5oxTbh2dS"] "Authentication Token not Matched!"

Comments