Mobile Google API OAuth 2.0:缺少必需参数:响应类型

Mobile Google API OAuth 2.0:缺少必需参数:响应类型,mobile,oauth,google-api,authorization,titanium,Mobile,Oauth,Google Api,Authorization,Titanium,我正试图在一个钛合金应用程序中从谷歌获得一个访问令牌,以访问Google+API。 我已在中注册了一个Android Oauth2.0客户端 所以我有一个客户端ID和几个由Google生成的重定向URI:[“urn:ietf:wg:oauth:2.0:oob”,“”]。 我正在尝试遵循授权代码流,因此我向端点“”发出了授权请求,使用以下参数作为查询字符串: client_id = encodeURI(<app id>) redirect_uri = encodeURI("urn:ie

我正试图在一个钛合金应用程序中从谷歌获得一个访问令牌,以访问Google+API。 我已在中注册了一个Android Oauth2.0客户端 所以我有一个客户端ID和几个由Google生成的重定向URI:[“urn:ietf:wg:oauth:2.0:oob”,“”]。 我正在尝试遵循授权代码流,因此我向端点“”发出了授权请求,使用以下参数作为查询字符串:

client_id = encodeURI(<app id>)
redirect_uri = encodeURI("urn:ietf:wg:oauth:2.0:oob")
response_type = "code",
state = <random generated number>
scope = "https://www.googleapis.com/auth/plus.me"
但我得到了一个400的状态代码,并显示以下消息:“缺少必需的参数:response_type”

我不知道为什么我会得到这个,因为访问令牌请求所需的参数只是grant_type、code、client_id和redirect_uri。我还尝试添加response_type=“token”,但如果我理解正确,应该是针对隐式流的


有什么建议吗?

我似乎发现了问题,令牌交换的端点不正确。 应该是“”,至少这个对我有用


我要指出的是,在谷歌最新的文档中,令牌交换的端点是这样的:“但由于某种原因,它对我不起作用(回复说服务器不支持url)。希望这能帮助有类似问题的人。

我也遇到过同样的问题,但没有提到正确的URL。 但是我注意到,当您注册一个客户端时,包含client_id和client_secret的JSON结果文件也包含auth_uri和token_uri


我希望这将有助于某人:)

在上,我找到了另一个适合我的URL:
https://www.googleapis.com/oauth2/v4/token
这应该是公认的答案。client_secret.*.json文件包含URL信息。
function getAccessToken(code) {

Ti.API.warn("Authorization code: " + code);

var auth_data = {
    code : code,
    client_id : client_id,
    redirect_uri : redirect_uri,
    grant_type : "authorization_code",
};


var client = Ti.Network.createHTTPClient({

    onload: function() {
        var response_data = JSON.parse(this.responseText);
        var access_token = response_data["access_token"];
        var expires_in = response_data["expires_in"];
    },


    onerror: function() {
        Ti.API.error("HTTPClient: an error occurred.");
        Ti.API.error(this.responseText);
    }

});

var body = "";

for (var key in auth_data) {
    if (body.length) {
        body += "&";
    }
    body += key + "=";
    body += encodeURIComponent(auth_data[key]);
}

client.open("POST", "https://accounts.google.com/o/oauth2/v2/auth");
client.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
client.send(body);


}