【发布时间】:2014-03-26 12:07:17
【问题描述】:
我很想通过在this guide 之后向 google 发送身份验证码来获取 google api 令牌。
这是我的代码:
$http({
method: 'POST',
url: 'https://accounts.google.com/o/oauth2/token',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
params : {
code : '4/heMv6ozWwCxS5RyTzCgThAgxvRyk.oske-bNEGOUTOl05ti8ZT3YnwwH8iQI',
client_id : GoogleAppInfo.clientId,
redirect_uri : GoogleAppInfo.redirect_uri,
client_secret : GoogleAppInfo.client_secret,
grant_type : 'authorization_code'
}
}).
success(function(data, status, headers, config) {
alert('secsses');
}).
error(function(data, status, headers, config) {
alert('error');
});
请求已发送,但未设置标头!
有谁知道问题出在哪里?
【问题讨论】:
-
你真的发送了吗?您似乎正在发送跨域请求。
-
是的。我发送了请求,这是我收到错误响应后来自 Firefox 控制台的请求。