Cordova 获取对googleapis的请求
我正在使用Cordova HTTP插件执行对googleapis服务器的HTTP GET请求 目前,我通过浏览器执行这种类型的请求,它可以工作:Cordova 获取对googleapis的请求,cordova,get,youtube-api,google-apis-explorer,Cordova,Get,Youtube Api,Google Apis Explorer,我正在使用Cordova HTTP插件执行对googleapis服务器的HTTP GET请求 目前,我通过浏览器执行这种类型的请求,它可以工作: https://www.googleapis.com/youtube/v3/search?key={myKey}&channelId={mychannel}&part=snippet,id&order=date&maxResults=20 现在我想通过插件执行这个调用。 我试过这个请求 cordovaHTTP.ge
https://www.googleapis.com/youtube/v3/search?key={myKey}&channelId={mychannel}&part=snippet,id&order=date&maxResults=20
现在我想通过插件执行这个调用。
我试过这个请求
cordovaHTTP.get("https://www.googleapis.com/youtube/v3/search?", {
key: "mykey",
channelId: "mychannel",
part: "snippet,id",
order: "date"
}, { Authorization: "OAuth2: token" },
function(response) {
alert(response.status);
}, function(response) {
alert(response.error);
});
尽管由于凭据无效,我收到了一个authError。
如何正确执行GET请求?
提前感谢好的。我删除了授权行(授权:“OAuth2:token”)。 这是正确的GET请求:
cordovaHTTP.get("https://www.googleapis.com/youtube/v3/search?", {
key: "mykey",
channelId: "mychannel",
part: "snippet,id",
order: "date"
}, { },
function(response) {
alert(response.status);
}, function(response) {
alert(response.error);
});