Google authentication

Introductory thoughts

The ServiceAPI (upon which WebDrawer and the Web Client are based) has a pluggable authentication module.  This allows for the support of a variety of identity providers (IdP).  For those considering Google as IdP this is the first step in that direction.

Breaking News!

While doing some testing in 8.2 I found a regression that means plugins will not work in the 82 Web Client (WebDrawer and ServiceAPI or OK).  This should be fixed in the first 82 patch.  So be warned, 811 should be fine but not 82, skip straight to 8.2 Patch 1 if you want to use Google authentication in the Web Client.

Looks simple to me

In which I demonstrate the process to:

  • create a Google Client Id
  • add the appropriate settings to the WebDrawer config files, and
  • copy the required DLLs.


You may note I do not make an effort to obscure the various bits of secret information in my Google Developer console.  Don't worry, I have re-set the sensitive bits.


Available to download are the:


The code remains the same but in HPRM 82 some interfaces have changed, use these for 82 instances:

Source of the source

For those interested the source for the above plugin all comes from ServiceStack framework (V3), look in the ServiceStack.Authentication.OAuth2 project and ServiceStack.ServiceInterface/Auth.


The steps I follow in the video above include:

Create a Google Client Id

Go to to create a project then create a client id for a web application

Edit the config files

In the WebDrawer web.config I add this in the appSettings element, making sure to use the correct WebDrawer URL of course:

<add key="oauth.RedirectUrl" value=""/>
<add key="oauth.CallbackUrl" value="{0}"/>
<add key="oauth.GoogleOAuth.ConsumerKey" value="YOUR_CLIENT_ID"/>
<add key="oauth.GoogleOAuth.ConsumerSecret" value="YOUR_SECRET"/>

In hptrim.config I add this:

  <add name="GoogleAuthPlugin" />

Copy the DLLs

Lastly I copy the DLLs into the WebDrawer\bin folder.

For the Web Client only

The Web Client embeds the ServiceAPI slightly differently to WebDrawer, for this reason you will need to add a login element to appSettings (in web.config), just like this one.

<add key="oauth.login" value="~/HPRMServiceAPI/auth/GoogleOAuth" />
Written on June 29, 2015