且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

发送http post请求以从身份验证代码获取令牌时出现400错误请求?

更新时间:2022-03-06 05:55:50

我得到了这个工作..我正在为那些被困在这个问题上的人分享代码:

I got this working.. i am sharing the code for those who are stuck with this:

$.ajax({
        dataType: "json",
        url:searchurl,
        data: {code:code, client_id:'clientid', client_secret:'secret', redirect_uri:'http://localhost:8085/GmailIntegration/getAuthResponse.jsp', grant_type:'authorization_code'},
        type:"POST",
        contentType:"application/x-www-form-urlencoded; charset=utf-8",
        crossDomain:true,
        cache : true, 
        success:function(data) {
            alert(data);
        },
        error: function(jqXHR, exception, errorstr) {
            console.log(jqXHR);
            alert(errorstr);
        }
    });

但现在我有新问题.url 得到 200 OK 响应,但我根本没有得到响应

but now i have new issue. The url get 200 OK response but i am not getting response at all