Files
documentation/content/applications/general/auth/google.rst
T

162 lines
5.8 KiB
ReStructuredText
Raw Normal View History

2021-06-14 13:51:07 +02:00
=============================
Google Sign-In Authentication
=============================
2023-03-29 19:14:39 +00:00
The *Google Sign-In Authentication* is a useful function that allows Odoo users to sign in to their
database with their Google account.
2023-03-29 19:14:39 +00:00
This is particularly helpful if the organization uses Google Workspace, and wants employees within
the organization to connect to Odoo using their Google Accounts.
2023-03-28 17:06:34 +00:00
.. seealso::
2023-03-29 19:14:39 +00:00
- :doc:`/applications/productivity/calendar/google`
2023-03-28 17:06:34 +00:00
- :doc:`/administration/maintain/google_oauth`
2021-06-14 13:51:07 +02:00
.. _google-sign-in/configuration:
2021-06-14 13:51:07 +02:00
Configuration
=============
2023-03-29 19:14:39 +00:00
The integration of the Google sign-in function requires configuration both on Google *and* Odoo.
2021-06-14 13:51:07 +02:00
.. _google-sign-in/api:
2021-06-14 13:51:07 +02:00
Google API Dashboard
--------------------
2021-06-14 13:51:07 +02:00
#. Go to the `Google API Dashboard <https://console.developers.google.com/>`_.
2023-03-29 19:14:39 +00:00
#. Make sure the right project is opened. If there isn't a project yet, click on :guilabel:`Create
Project`, fill out the project name and other details of the company, and click on
:guilabel:`Create`.
2021-06-14 13:51:07 +02:00
.. image:: google/new-project-details.png
:align: center
2023-03-29 19:14:39 +00:00
:alt: Filling out the details of a new project.
2021-06-14 13:51:07 +02:00
.. tip::
2023-03-29 19:14:39 +00:00
Choose the name of the company from the drop-down menu.
2021-06-14 13:51:07 +02:00
.. _google-sign-in/oauth:
2021-06-14 13:51:07 +02:00
OAuth consent screen
~~~~~~~~~~~~~~~~~~~~
2021-06-14 13:51:07 +02:00
#. On the left side menu, click on :menuselection:`OAuth consent screen`.
2021-06-14 13:51:07 +02:00
.. image:: google/consent-selection.png
:align: center
2023-03-29 19:14:39 +00:00
:alt: Google OAuth consent selection menu.
2023-03-29 19:14:39 +00:00
#. Choose one of the options (:guilabel:`Internal` / :guilabel:`External`), and click on
:guilabel:`Create`.
2021-06-14 13:51:07 +02:00
.. image:: google/consent.png
:align: center
2023-03-29 19:14:39 +00:00
:alt: Choice of a user type in OAuth consent.
2023-03-29 19:14:39 +00:00
.. warning::
*Personal* Gmail Accounts are only allowed to be **External** User Type, which means Google
may require an approval, or for *Scopes* to be added on. However, using a *Google WorkSpace*
account allows for **Internal** User Type to be used.
Note, as well, that while the API connection is in the *External* testing mode, then no
approval is necessary from Google. User limits in this testing mode is set to 100 users.
#. Fill out the required details and domain info, then click on :guilabel:`Save and Continue`.
#. On the :menuselection:`Scopes` page, leave all fields as is, and click on :guilabel:`Save and
Continue`.
#. Next, if continuing in testing mode (*External*), add the email addresses being configured under
the :guilabel:`Test users` step by clicking on :guilabel:`Add Users`, and then the
:guilabel:`Save and Continue` button. A summary of the app registration appears.
#. Finally, scroll to the bottom, and click on :guilabel:`Back to Dashboard`.
2021-06-14 13:51:07 +02:00
.. _google-sign-in/credentials:
Credentials
~~~~~~~~~~~
#. On the left side menu, click on :menuselection:`Credentials`.
.. image:: google/credentials-button.png
:align: center
2023-03-29 19:14:39 +00:00
:alt: Credentials button menu.
2021-06-14 13:51:07 +02:00
2023-03-29 19:14:39 +00:00
#. Click on :guilabel:`Create Credentials`, and select :guilabel:`OAuth client ID`.
2021-06-14 13:51:07 +02:00
.. image:: google/client-id.png
:align: center
2023-03-29 19:14:39 +00:00
:alt: OAuth client id selection.
2021-06-14 13:51:07 +02:00
2023-03-29 19:14:39 +00:00
#. Select :guilabel:`Web Application` as the :guilabel:`Application Type`. Now, configure the
allowed pages on which Odoo will be redirected.
2022-11-18 10:10:48 +00:00
2023-03-29 19:14:39 +00:00
In order to achieve this, in the :guilabel:`Authorized redirect URIs` field, enter the database's
domain immediately followed by `/auth_oauth/signin`. For example:
`https://mydomain.odoo.com/auth_oauth/signin`, then click on :guilabel:`Create`.
2021-06-14 13:51:07 +02:00
2023-03-29 19:14:39 +00:00
#. Now that the *OAuth client* has been created, a screen will appear with the :guilabel:`Client ID`
and :guilabel:`Client Secret`. Copy the :guilabel:`Client ID` for later, as it will be necessary
for the configuration in Odoo, which will be covered in the following steps.
2021-06-14 13:51:07 +02:00
.. _google-sign-in/auth-odoo:
Google Authentication on Odoo
-----------------------------
.. _google-sign-in/client-id:
Retrieve the Client ID
~~~~~~~~~~~~~~~~~~~~~~
2023-03-29 19:14:39 +00:00
Once the previous steps are complete, two keys are generated on the Google API Dashboard:
:guilabel:`Client ID` and :guilabel:`Client Secret`. Copy the :guilabel:`Client ID`.
2021-06-14 13:51:07 +02:00
.. image:: google/secret-ids.png
:align: center
2023-03-29 19:14:39 +00:00
:alt: Google OAuth Client ID generated.
2021-06-14 13:51:07 +02:00
.. _google-sign-in/odoo-activation:
Odoo activation
~~~~~~~~~~~~~~~
2023-03-29 19:14:39 +00:00
#. Go to :menuselection:`Odoo General Settings --> Integrations` and activate :guilabel:`OAuth
Authentication`.
2021-06-14 13:51:07 +02:00
.. note::
2023-03-29 19:14:39 +00:00
Odoo may prompt the user to log-in again after this step.
2022-11-18 10:10:48 +00:00
2023-03-29 19:14:39 +00:00
#. Go back to :menuselection:`General Settings --> Integrations --> OAuth Authentication`, activate
the selection and :guilabel:`Save`. Next, return to :menuselection:`General Settings -->
Integrations --> Google Authentication` and activate the selection. Then fill out the
:guilabel:`Client ID` with the key from the Google API Dashboard, and :guilabel:`Save`.
2021-06-14 13:51:07 +02:00
.. image:: google/odoo-client-id.png
:align: center
2023-03-29 19:14:39 +00:00
:alt: Filling out the client id in Odoo settings.
.. note::
Google OAuth2 configuration can also be accessed by clicking on :guilabel:`OAuth Providers`
under the :guilabel:`OAuth Authentication` heading in :menuselection:`Integrations`.
2021-06-14 13:51:07 +02:00
.. _google-sign-in/log-in:
Log in to Odoo with Google
==========================
2023-03-29 19:14:39 +00:00
To link the Google account to the Odoo profile, click on :guilabel:`Log in with Google` when first
logging into Odoo.
2021-06-14 13:51:07 +02:00
.. image:: google/first-login.png
:align: center
2023-03-29 19:14:39 +00:00
:alt: Reset password screen with "Log in with Google" button.
2021-06-14 13:51:07 +02:00
2023-03-29 19:14:39 +00:00
Existing users must :ref:`reset their password <users/reset-password>` to access the
:menuselection:`Reset Password` page, while new users can directly click on :guilabel:`Log in with
Google`, instead of choosing a new password.
2021-06-14 13:51:07 +02:00
.. seealso::
- `Google Cloud Platform Console Help - Setting up OAuth 2.0
<https://support.google.com/cloud/answer/6158849>`_