cloudendpoints / endpoints-java

A Java framework for building RESTful APIs on Google App Engine
Apache License 2.0
32 stars 35 forks source link

Handle properly Google's tokeninfo 503/backend error #141

Closed clementdenis closed 6 years ago

clementdenis commented 6 years ago

We are using Cloud Endpoints to serve a large scale API (millions of API requests per day). We measure a low but significant amount of transient "503/backend error" when validating OAuth2 requests with GoogleAuth#getTokenInfoRemote, that translates into a "401/UnauthorizedException" for the API clients => this is not what one would expect for a transient exception.

This pull request introduce two main changes:

codecov-io commented 6 years ago

Codecov Report

Merging #141 into master will increase coverage by 0.06%. The diff coverage is 80.95%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #141      +/-   ##
============================================
+ Coverage     79.95%   80.02%   +0.06%     
- Complexity     1673     1677       +4     
============================================
  Files           156      156              
  Lines          5573     5591      +18     
  Branches        725      729       +4     
============================================
+ Hits           4456     4474      +18     
+ Misses          841      840       -1     
- Partials        276      277       +1
Impacted Files Coverage Δ Complexity Δ
...le/api/server/spi/auth/EndpointsAuthenticator.java 100% <ø> (ø) 6 <0> (ø) :arrow_down:
.../server/spi/auth/GoogleAppEngineAuthenticator.java 85.45% <ø> (ø) 16 <0> (ø) :arrow_down:
...api/server/spi/auth/GoogleOAuth2Authenticator.java 87.09% <ø> (ø) 10 <0> (ø) :arrow_down:
...ava/com/google/api/server/spi/auth/GoogleAuth.java 85.71% <80.95%> (+0.96%) 33 <5> (+3) :arrow_up:
...rver/spi/response/ServiceUnavailableException.java 14.28% <0%> (+14.28%) 1% <0%> (+1%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 36333f9...031de81. Read the comment docs.

clementdenis commented 6 years ago

Fixed formatting (and too long lines as well). As there are only format change, I amended my commit and force pushed.

I'm coding with IntelliJ, can you confirm I should use Google's style guide?