我有消费者密钥,消费者秘密,令牌密钥和令牌秘密来获取数据API。邮递员就是这样的:

我必须像上面的捕获邮递员一样获取API中的数据。我对阿拉莫火有这样的方法请求:
Alamofire.request("https://conversation.8villages.com/1.0/contents/articles?state=published", headers: headers).responseJSON { response in
print("test", response.request!) // original URL request
print("ini responseny", response.response!) // HTTP URL response
print("test", response.data!) // server data
print("test", response.result) // result of response serialization
if let JSON = response.result.value {
print("JSON: \(JSON)")
}
}因此,我不知道如何添加或传递我的令牌到in方法get。谁来帮帮我拜托。
我用的是OAuthSwift和阿拉莫火。
发布于 2017-04-27 04:33:56
尝尝这个
let headers: HTTPHeaders = [
"Authorization": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
"Accept": "application/json"
]
Alamofire.request("https://httpbin.org/headers", headers: headers).responseJSON { response in
debugPrint(response)
}https://stackoverflow.com/questions/43648683
复制相似问题