2

I am looking for Oauth 2.0 implementation to Google Endpoint project developed in Java. Client will be web and Android. Kindly suggest how to implement it. I have searched lot of google docs. Each doc details something but I couldn't connect dots basically. Anyone has implemented OAuth 2.0 in Google Endpoint ?

  • 2
    There is a step by step guide for OAuth with Google here: https://cloud.google.com/appengine/docs/java/endpoints/auth – konqi Oct 19 '15 at 17:12
  • 2
    There's also this: http://stackoverflow.com/questions/25365858/google-cloud-endpoints-and-users-authentication if you want more than just Google OAuth. – konqi Oct 19 '15 at 17:14
  • @konqi first of all thanks for ur inputs. I have gone through the first link already. I have made changes also for one of my endpoint method with user object. When I tried to test it from Google API explorer, I am getting user object as null always. Do you know how to test authentication from Google API explorer? – Karthikaiselvan Oct 20 '15 at 17:52
  • @konqi, Do we need to write a J2EE Filter to validate the OAuth access token? or App Engine is having some implemetation(we just need to enable it). I am bit confused, how to enable OAuth 2.0 for my Enpoint APIs. – Karthikaiselvan Oct 25 '15 at 17:19
  • @Karthikaiselvan: the [first link provided above](https://cloud.google.com/appengine/docs/java/endpoints/auth) has steps which explain what is necessary to get a null or non-null User object. I suggest you re-read the relevant doc and review your code to determine why the User object is appearing as `null`. – Nick Oct 27 '15 at 21:54
  • @Nick, Thank you anyway!. I have resolved it. Actually, Google Cloud Endpoint has its own implementation (handled internally) to verify access token from request header and injects User object into endpoint methods. So, once I started passing valid access token using Postman client using OAuth 2.0 security mode, it has started giving valid User object. – Karthikaiselvan Oct 30 '15 at 08:18
  • @Karthikaiselvan that's great news! Would you mind posting that as a self-answer, possibly including an example (destroy or change the token somehow) HTTP request header as your server sees it, or as your browser sees it in the developer tools network tab? – Nick Oct 30 '15 at 13:33
  • @Nick Sorry for late update. Here is the doc link for the step by step explanation. https://docs.google.com/document/d/16CJwGnqqZMx7Gk3i3X9q81ptcVl7pWqorAkBEp08u58/edit?usp=sharing – Karthikaiselvan Jan 13 '16 at 19:38

0 Answers0