Error while requesting POST method to server


#1

I’m using google plus login plugin and after getting response from the google i’m sending(POST method) serverAuthCode to server . Now i’m getting 403 forbidden error.

then i tries proxy setting in ionic.config.json file.

"proxies": [{
          "path": "*/api",
          "proxyUrl": "https://violet.mobigraph.co/ginger"
    }]

then it gives 404 then i checked it was using “file://” instead of “https://”

POST /ginger/gauth/oauth2callback?code=4/ew7Ls8ociCHw0_TF7yU9WJpFtCityZnAHO8OaCAQOMA&state=51 HTTP/1.1
X-Forwarded-For: 180.215.120.217
Host: violet.mobigraph.co
Connection: close
Content-Length: 121
Accept: application/json, text/plain, /
Origin: file://
User-Agent: Mozilla/5.0 (Linux; Android 4.4.4; 2014818 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36
content-type: application/json
Accept-Encoding: gzip,deflate
Accept-Language: en-US
X-Requested-With: com.ionicframework.ginger700193

what is that i’m doing wrong? help!!.


#2

This is a server side error, which means that the request went out, but the server didn’t like the request for some reason. You should use your browser’s dev tools to look at the request and compare it to how the request should look like.

This looks wrong: https://github.com/ionic-team/ionic-cli#service-proxies There should be no * there and then after correctly configuring it you would just write /api where you had https://violet.mobigraph.co/ginger before - no other changes. (But you probably don’t even need Service proxies, as the 403 was most probably caused by a wrong request…)