Okay, I'm stuck authenticating to the Google API.
NOTE: I am waiting to hear back from the network people on what might be in some logs, but I thought I would post a question here in case there is something else I can do.
If I created the following cURL command correctly, the following is what happens when I run it from the command line on the server.
I did add "-x http://webproxy.h.corp.junk:80" to the cURL to explicitly set the proxy
The parameters are the same as I use in a Java test HTTP post that works just fine on my local workstation (see below).
curl -v -k -x http://webproxy.h.corp.junk:80 --header "Content-Type: application/x-www-form-urlencoded" \
> -F 'grant_type=refresh_token' \
> -F 'refresh_token=1/hDGjsPYJd****************' \
> -F 'client_id=628259514038-96*************.apps.googleusercontent.com' \
> -F 'client_secret=******************' \
> https://accounts.google.com/o/oauth2/token
* About to connect() to proxy webproxy.h.corp.services port 80 (#0)
* Trying 163.231.26.134... connected
* Connected to webproxy.h.corp.services (163.231.26.134) port 80 (#0)
* Establish HTTP proxy tunnel to accounts.google.com:443
> CONNECT accounts.google.com:443 HTTP/1.1
> Host: accounts.google.com:443
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Proxy-Connection: Keep-Alive
>
< HTTP/1.0 200 Connection established
<
* Proxy replied OK to CONNECT request
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=accounts.google.com,O=Google Inc,L=Mountain View,ST=California,C=US
* start date: Sep 14 08:44:36 2016 GMT
* expire date: Dec 07 08:19:00 2016 GMT
* common name: accounts.google.com
* issuer: CN=Google Internet Authority G2,O=Google Inc,C=US
> POST /o/oauth2/token HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: accounts.google.com
> Accept: */*
> Content-Length: 601
> Expect: 100-continue
> Content-Type: application/x-www-form-urlencoded; boundary=----------------------------8c681bcd32df
>
* Done waiting for 100-continue
< HTTP/1.1 400 Bad Request
< Content-Type: application/json; charset=utf-8
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: Mon, 01 Jan 1990 00:00:00 GMT
< Date: Fri, 30 Sep 2016 13:05:52 GMT
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< Server: GSE
< Alt-Svc: quic=":443"; ma=2592000; v="36,35,34,33,32"
< Accept-Ranges: none
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
<
{
"error" : "invalid_request",
"error_description" : "Required parameter is missing: grant_type"
* Connection #0 to host webproxy.h.corp.services left intact
* Closing connection #0
}
When I run the test on my workstation with the same HTTP post request parameters being set I successfully obtain the required authentication token back from Google.
This is the code snippet that is throwing the exception.
HttpResponse httpResponse = httpclient.execute(httppost);
When this code executes on the server I receive the following exception after 20 secconds.
org.apache.http.conn.HttpHostConnectException: Connection to https://accounts.google.com refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
at com.findlaw.adwords.AdWordsApiApplication.run(AdWordsApiApplication.java:87)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
at com.findlaw.adwords.AdWordsApiApplication.main(AdWordsApiApplication.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:414)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
... 16 more
Groups "AdWords API Forum" group.
You received this message because you are subscribed to the Google Groups "AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
.
.
.
.