google: Use new endpoints for Google authentication

Fixes #310

Change-Id: I3b3a57b2758074535d07471b344334945be5bcbd
Reviewed-on: https://go-review.googlesource.com/c/136356
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
diff --git a/google/google.go b/google/google.go
index 4b0b547..df8e87d 100644
--- a/google/google.go
+++ b/google/google.go
@@ -20,12 +20,12 @@
 // Endpoint is Google's OAuth 2.0 endpoint.
 var Endpoint = oauth2.Endpoint{
 	AuthURL:   "https://accounts.google.com/o/oauth2/auth",
-	TokenURL:  "https://accounts.google.com/o/oauth2/token",
+	TokenURL:  "https://oauth2.googleapis.com/token",
 	AuthStyle: oauth2.AuthStyleInParams,
 }
 
 // JWTTokenURL is Google's OAuth 2.0 token URL to use with the JWT flow.
-const JWTTokenURL = "https://accounts.google.com/o/oauth2/token"
+const JWTTokenURL = "https://oauth2.googleapis.com/token"
 
 // ConfigFromJSON uses a Google Developers Console client_credentials.json
 // file to construct a config.
diff --git a/google/google_test.go b/google/google_test.go
index 287c699..be30b08 100644
--- a/google/google_test.go
+++ b/google/google_test.go
@@ -110,7 +110,7 @@
 	if err != nil {
 		t.Fatal(err)
 	}
-	if got, want := conf.TokenURL, "https://accounts.google.com/o/oauth2/token"; got != want {
+	if got, want := conf.TokenURL, "https://oauth2.googleapis.com/token"; got != want {
 		t.Errorf("TokenURL = %q; want %q", got, want)
 	}
 }
diff --git a/google/testdata/gcloud/credentials b/google/testdata/gcloud/credentials
index ff5eefb..0930d8a 100644
--- a/google/testdata/gcloud/credentials
+++ b/google/testdata/gcloud/credentials
@@ -24,7 +24,7 @@
         },
         "invalid": false,
         "refresh_token": "foo_refresh_token",
-        "revoke_uri": "https://accounts.google.com/o/oauth2/revoke",
+        "revoke_uri": "https://oauth2.googleapis.com/revoke",
         "token_expiry": "2015-01-09T00:51:51Z",
         "token_response": {
           "access_token": "foo_access_token",
@@ -32,7 +32,7 @@
           "id_token": "foo_id_token",
           "token_type": "Bearer"
         },
-        "token_uri": "https://accounts.google.com/o/oauth2/token",
+        "token_uri": "https://oauth2.googleapis.com/token",
         "user_agent": "Cloud SDK Command Line Tool"
       },
       "key": {
@@ -66,7 +66,7 @@
         },
         "invalid": false,
         "refresh_token": "bar_refresh_token",
-        "revoke_uri": "https://accounts.google.com/o/oauth2/revoke",
+        "revoke_uri": "https://oauth2.googleapis.com/revoke",
         "token_expiry": "2015-01-09T00:51:51Z",
         "token_response": {
           "access_token": "bar_access_token",
@@ -74,7 +74,7 @@
           "id_token": "bar_id_token",
           "token_type": "Bearer"
         },
-        "token_uri": "https://accounts.google.com/o/oauth2/token",
+        "token_uri": "https://oauth2.googleapis.com/token",
         "user_agent": "Cloud SDK Command Line Tool"
       },
       "key": {
@@ -91,11 +91,11 @@
         "_module": "oauth2client.client",
         "_private_key_id": "00000000000000000000000000000000",
         "_private_key_pkcs8_text": "-----BEGIN RSA PRIVATE KEY-----\nMIICWwIBAAKBgQCt3fpiynPSaUhWSIKMGV331zudwJ6GkGmvQtwsoK2S2LbvnSwU\nNxgj4fp08kIDR5p26wF4+t/HrKydMwzftXBfZ9UmLVJgRdSswmS5SmChCrfDS5OE\nvFFcN5+6w1w8/Nu657PF/dse8T0bV95YrqyoR0Osy8WHrUOMSIIbC3hRuwIDAQAB\nAoGAJrGE/KFjn0sQ7yrZ6sXmdLawrM3mObo/2uI9T60+k7SpGbBX0/Pi6nFrJMWZ\nTVONG7P3Mu5aCPzzuVRYJB0j8aldSfzABTY3HKoWCczqw1OztJiEseXGiYz4QOyr\nYU3qDyEpdhS6q6wcoLKGH+hqRmz6pcSEsc8XzOOu7s4xW8kCQQDkc75HjhbarCnd\nJJGMe3U76+6UGmdK67ltZj6k6xoB5WbTNChY9TAyI2JC+ppYV89zv3ssj4L+02u3\nHIHFGxsHAkEAwtU1qYb1tScpchPobnYUFiVKJ7KA8EZaHVaJJODW/cghTCV7BxcJ\nbgVvlmk4lFKn3lPKAgWw7PdQsBTVBUcCrQJATPwoIirizrv3u5soJUQxZIkENAqV\nxmybZx9uetrzP7JTrVbFRf0SScMcyN90hdLJiQL8+i4+gaszgFht7sNMnwJAAbfj\nq0UXcauQwALQ7/h2oONfTg5S+MuGC/AxcXPSMZbMRGGoPh3D5YaCv27aIuS/ukQ+\n6dmm/9AGlCb64fsIWQJAPaokbjIifo+LwC5gyK73Mc4t8nAOSZDenzd/2f6TCq76\nS1dcnKiPxaED7W/y6LJiuBT2rbZiQ2L93NJpFZD/UA==\n-----END RSA PRIVATE KEY-----\n",
-        "_revoke_uri": "https://accounts.google.com/o/oauth2/revoke",
+        "_revoke_uri": "https://oauth2.googleapis.com/revoke",
         "_scopes": "https://www.googleapis.com/auth/appengine.admin https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/ndev.cloudman https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/sqlservice.admin https://www.googleapis.com/auth/prediction https://www.googleapis.com/auth/projecthosting",
         "_service_account_email": "baz@serviceaccount.example.com",
         "_service_account_id": "baz.serviceaccount.example.com",
-        "_token_uri": "https://accounts.google.com/o/oauth2/token",
+        "_token_uri": "https://oauth2.googleapis.com/token",
         "_user_agent": "Cloud SDK Command Line Tool",
         "access_token": null,
         "assertion_type": null,
@@ -104,7 +104,7 @@
         "id_token": null,
         "invalid": false,
         "refresh_token": null,
-        "revoke_uri": "https://accounts.google.com/o/oauth2/revoke",
+        "revoke_uri": "https://oauth2.googleapis.com/revoke",
         "service_account_name": "baz@serviceaccount.example.com",
         "token_expiry": null,
         "token_response": null,