OmniAuth Google OAuth2 strategy – where to get Google Key and Secret

Having spent too much time ironically on Google searching for how to obtain a Google Key and Google Secret (for OAuth2) I decided to post this for future reference.

I’m assuming that you are implementing some Google authentication functionality with something like OmniAuth (Ruby on Rails gem).  Whether it is OmniAuth or not you’ll need to register your application with Google; obtaining a Google Key and Google Secret as well as setting a callback url.

  1. Go to https://code.google.com/apis/console, log in with your Google account and click on API Access.
  2. Create OAuth2 credentials by clicking the big blue OAuth2 button.
  3. Set the callback url and the name of your app (can be edited later)
  4. The Google Key (as it is referred to by OmniAuth) is the Client ID
  5. The Google Secret (as it is referred to by OmniAuth) is the Client Secret
  6. Use those credentials as per your documentation for implementing OAuth2 authentication.

The Google OmniAuth strategy for OAuth2 is here: https://github.com/zquestz/omniauth-google-oauth2.  Look in the examples folder for details on the rest of the implementation.

Advertisements