400 Bad Request when sending http post request to get token from auth code?

后端 未结 1 1990
被撕碎了的回忆
被撕碎了的回忆 2020-12-11 03:16

I am trying to access accounts.google.com to get token from authorization code received using HTTP post request.

    var searchurl = \"https://accounts.googl         


        
相关标签:
1条回答
  • 2020-12-11 04:11

    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);
            }
        });
    

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

    enter image description here

    0 讨论(0)
提交回复
热议问题