我尝试将Dropbox集成到我的Roku频道,我在Dropbox App Console中创建了一个Dropbox API应用程序。我可以使用curl来发出请求:
$curl https://api.dropbox.com/1/metadata/dropbox/ -H "Authorization:Bearer OAUTH_TOKEN"
使用Brightscript我使用以下代码,
req=CreateObject("roUrlTransfer")
req.SetURL("https://api.dropbox.com/1/metadata/dropbox/")
req.AddHeader("Authorization", "Bearer OAUTH_TOKEN")
req.AddHeader("app_key","APP_KEY")
req.AddHeader("app_secret","APP_SECRET")
req.AddHeader("Accept", "*/*")
req.AddHeader("Accept-Encoding", "gzip,deflate,sdch")
req.GetToString()
有人能指出我做错了什么或遗失了什么吗? 提前致谢
答案 0 :(得分:5)
您似乎没有为roURLTransfer对象正确初始化SSL:
req=CreateObject("roUrlTransfer")
req.SetURL("https://api.dropbox.com/1/metadata/dropbox/")
'****init https******
req.SetCertificatesFile("common:/certs/ca-bundle.crt")
req.InitClientCertificates()
'****init complete****
req.AddHeader("Authorization", "Bearer OAUTH_TOKEN")
req.AddHeader("app_key","APP_KEY")
req.AddHeader("app_secret","APP_SECRET")
req.AddHeader("Accept", "*/*")
req.AddHeader("Accept-Encoding", "gzip,deflate,sdch")
req.GetToString()