我在twitter friends / list API中收到了Bad Authentication数据响应.登录时我收到用户ID,屏幕名称,authToken和authTokenSecret. func loadFollowers(userid:String) { //let twapi = "https://api.twitter.com/1.1/followers/list.js
func loadFollowers(userid:String) { //let twapi = "https://api.twitter.com/1.1/followers/list.json?cursor=-1&user_id=\(session)&count=5000" let twapi = "https://api.twitter.com/1.1/friends/list.json?cursor=-1&user_id=\(userid)&count=10" let url2 = URL(string: twapi)! print(url2) URLSession.shared.dataTask(with: url2, completionHandler: { (data, response, error) in //UIApplication.shared.isNetworkActivityIndicatorVisible = false do { let userData = try JSONSerialization.jsonObject(with: data!, options:[]) print(userData) } catch { NSLog("Account Information could not be loaded \(error)") } }).resume() }
输出:
{ "errors": [ { "code": 215, "message": "Bad Authentication data." } ] }
在friends / list.json API中发送的必需参数是什么.
在本文档中,他们给出的所有参数都是可选的
https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-list