In odoo, the normal method for login is by entering username and password. Apart from this, there is also an option to log in to odoo using other social media accounts. This option allows the users to sign in odoo using their google or Facebook account. Before moving further, first make sure that the incoming and outgoing server is set properly. Refer to this blog for more info on the email configuration in odoo.
After setting up the email configuration, go to settings -> general settings and enable the option OAuth Authentication.
Once it is enabled and saved, you can see a new option
Enable Google Authentication to allow users to sign in with their google account. Once this is enabled, you can see an option to enter the client id.
Click on the tutorial option to see how to get a client id.
To get client id, login to your google account and go to https://console.developers.google.com/
After this, create a new project and click on the auth consent screen. Fill the application name and save.
After saving, click on credentials and select OAuth Client ID.
Select web application from the list and enter a valid redirect URL. Entering the raw IP address (http://0.0.0.0:8013/auth_oauth/signin) is not allowed. It should be a proper domain name or IP address with .com or org.
Once you click on Create, You will get a window that displays the client id and the client secret. Now go to Odoo and enter the client id in the settings -> general settings -> google authentication -> client ID field and click on save. Then go to settings -> Users and you can see the new tab Oath with the oath providers list.
Open Odoo.com Accounts and untick the option allowed, then open Google OAuth2 and enable the option allowed. Now we can create new users with the email address of the user given as google account email address, give OAuth provider as Google OAuth2. Then save the record . Then on the login page, you can see the option login with google account.
When you select to log in with google option, then you will be redirected to Google login page and once the login is successful, it will redirect to odoo.
Use Facebook login:
Another option to sign in to odoo is using the user’s Facebook account. For this, go to https://developers.facebook.com/apps and log in using your Facebook account. Then click on the option to add a new app.
Provide name and email for the app and click on the create app id button.
Once the app is created, we can see the created app and app id. Provide the domain of odoo, complete URL in the settings of the newly created app. Domain given should be the same as the domain used in odoo. Save the data and copy the newly created app id. Now go to odoo and from Settings – > Oath providers open Facebook Graph. Then enable the option allowed.
Once allowed, you can go to the login page and there you will see the new option to log in with Facebook.