Recently i worked on accessing google apis through Service account. It was real fun to work on open source for the reason : little literature is available for this;learned how to use oAuth2.0 protocol for authentication using JWT(JSon Web Token).

Service account in google basically allows application to connect to google apis using the access token received for JWT. So manual intervention of user is eliminated which otherwise is required to authorize request.

Service account basically uses following steps:
Currently only following google apis supports service account:
  • Google Cloud Storage
  • Google Prediction API
  • Google URL Shortener
  • Google OAuth 2.0 Authorization Server
  • Google APIs Console
  • Google APIs Client Libraries for Python, Java, and PHP
C# implementation for using service account is attached.
Implementation details:
Used service account to access google+ api.
BoucyCastle libraries are used for SHA256withRSA signing. (this algorithm is supported by framework only on operating systems win 2k3 and above. So used this open source implementation).
Used DataContractJsonSerializer to parse Json response.


Download Code


Comments

Popular posts from this blog

Inversion of control in 3 layer architecture

Singleton pattern for logger class

Consistent Response Validation - Invalid Value for types & Business Rules in Web API