odoo tricks

Tips and tricks for Odoo (OpenERP)

Setting up Google Apps authentication with Odoo 8

If you have Google Apps then you probably want to allow your Odoo users to login with their Google account. The good news is Odoo supports OAuth authentication which means it plays nicely with Google Apps. However setting this up can be quite tricky. In this guide I’m going to step you through the process so you can get it working first time.

Note that Google Apps is different to standalone GMail. You must follow each of the steps below in sequence otherwise your authentication process will fail.

There are six main steps:

  1. Enable OAuth authentication support in Odoo
  2. Enable the Google App Engine Admin Console in your Google Apps domain
  3. Create Google Apps OAuth2 access for Odoo
  4. Add Google OAuth2 credentials to Odoo
  5. Create a new Odoo user with Google Apps authentication
  6. Activating Google Apps authentication for new user

Important: Make sure Odoo is correctly configured to send email before starting this tutorial. Odoo will need to email an activation link when you enable OAUTH.

So, let’s get started.

Enabling OAuth Support in Odoo

  1. Login to Odoo as the Administrator
  2. Browse to Settings -> Apps
  3. In the search box, clear the Apps filter
  4. Search for OAuth2
  5. Click Install to add the OAuth2 Authentication module

Enabling Google App Engine Admin Console

  1. Browse to https://admin.google.com and login as the Google domain adminstrator
  2. Click More Controls at the bottom of the page
  3. Click More Google Apps
  4. Click the X next to Filter: Top featured services to clear the filter
  5. Scroll down the list and click Google App Engine Admin Console
  6. Turn it ON for everyone

Create Google Apps OAuth2 access for Odoo

  1. Browse to https://console.developers.google.com/project and if necessary login
  2. Click Create Project
  3. In Project Name enter whatever you want, e.g. OdooERP
  4. Click Create
  5. In the menu on the left, expand APIs & auth then click Credentials
  6. Click Create new Client ID
  7. Under Authorized JavaScript origins enter your server domain name, e.g. http://odoo.mydomain.com
  8. Under Authorized redirect URI enter you domain plus the OAUTH path, e.g. http://odoo.mydomain.com/auth_oauth/signin
  9. Click Create client ID
  10. In the menu click Consent screen
  11. Select an email address from the drop down menu
  12. In Product Name enter a description, e.g. OdooERP
  13. Click Save
  14. In the menu click Credentials and leave the browser window open

Add Google OAuth2 credentials to Odoo

  1. Login to Odoo as the Administrator
  2. Browse to Settings -> OAuth Providers
  3. Click Odoo.com Accounts to open the settings window
  4. Click Edit then uncheck the Allowed checkbox
  5. Click Save then click Providers to return to the list
  6. Click Google OAuth2 to open the settings window
  7. Click Edit
  8. From the Google Developers Console, copy and paste the Client ID into the box in Odoo
  9. Check the Allowed checkbox
  10. Click Save

Create a new Odoo user with Google Apps authentication

  1. In Odoo browse to Settings -> Users
  2. Click Create
  3. Complete at least the Name and E-mail Address fields. The E-mail Address field for the Odoo user must match the users Google Apps account.
  4. Click the Oauth tab
  5. In the OAuth Provider drop down menu, select Google OAuth2
  6. Click Save
  7. Note the user will be sent an email to activate their account. The URL is also shown at the top of the window.

Activating Google Apps authentication for new user

Tip: Before proceeding through this section, I recommend you launch a new browser window in “Private” or “Incognito” mode to avoid conflicts with any existing user credentials or active sessions.

  1. Either copy-paste the activation URL from step 7 above into your new private browser window, or click the URL in the activation email your new user should have received
  2. On the Odoo login page, click Log in in with google link
  3. If prompted, enter your Google Apps username and password
  4. When prompted allow Odoo to access the required Google Apps information
  5. You should now be logged into Odoo!
Advertisements

12 responses to “Setting up Google Apps authentication with Odoo 8

  1. Els October 28, 2016 at 12:14 pm

    Thanks for a great article! Is their a way to disable the standard login procedure? If we’re only able to login with Google, we benefit from its two factor authentication.

    Like

  2. Graham November 19, 2015 at 11:27 am

    This tutorial seem to be outdated.
    google has updated their website and menus

    Like

  3. rafael March 12, 2015 at 10:03 am

    i also encounter error,i already accept the invitation but “Error: redirect_uri_mismatch”..Please need your help..thank you.

    Like

  4. B January 15, 2015 at 8:20 pm

    Have you had any luck using the Google Calendar sync feature for users with Google Apps email addresses? Our calendar sync works for a standard @gmail address but not with an @gapps address.

    Like

  5. Ro January 1, 2015 at 5:30 pm

    Thanks for posting this. I thought for sure I followed all required steps. I was getting the following error when a user was trying to login via Oauth2 Google apps on Odoo 8:

    You do not have access to this database or your invitation has expired.
    Please ask for an invitation and be sure to follow the link in your invitation email

    The key to eliminating the above error was to generate a “password reset” for the user. This causes Odoo to generate an auth token which is required for first login using Oath2.

    Thank you!

    Liked by 1 person

    • daviddean99 January 1, 2015 at 5:31 pm

      Thanks for your feedback. I will add your information to the tutorial so it Will benefit others.

      Like

      • Ro January 1, 2015 at 5:57 pm

        The difference was setting up Oauth2 for existing users.

        Also worth mentioning, Odoo has to have a functioning email server setup. I didn’t have email setup, so when clicking “reset password” I simply got smtp error. Once I setup email all was good. The nice thing about “password reset” from user admin panel, the actual link is displayed. It’s not even necessary to go into users email to retrieve the url containing the token.

        Thanks again, your steps “Activating Google Apps authentication for new user” was the key for me finding my problem!

        Like

    • O February 3, 2015 at 12:02 pm

      Hope you get this.
      I too configured it all correctly and getting that same ‘You do not have access to this database or your invitation has expired. Please ask for an invitation and be sure to follow the link in your invitation email.’ error.
      Resetting the password of that 1 user doesn’t seem to cut it, except from login with that same user.
      Any other Google Apps user gets this error, please advise,
      O

      Liked by 1 person

  6. Openies November 27, 2014 at 5:57 am

    Nice Informative article..! 🙂

    Like

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: