Enable Dark Mode!
social-site-authentication-odoo10.png
By: Linto

Social site authentication in odoo v10

Functional Odoo 10

In Odoo, each user will have a username and a password. They can sign into Odoo with this username and password. Other than this, Odoo provides options for the users to sign in with other accounts such as google or facebook.


For enabling this feature, first, we have to make sure that the incoming and outgoing mail servers are correctly configured. This can be done under the 'Email' menu in the settings. It is already discussed in another blog. After it is done, go to Settings -> General Settings and enable the 'Authentication' option.


social-site-authentication-odoo10-cybrosys


Apply the changes and you can see a new option has appeared.


social-site-authentication-odoo10-cybrosys


Enable the 'Authentication' option to allow users to sign in with Google. Once this option is enabled, we can see a field to enter the google client id. If you do not have a client id, you have to obtain one first.


You can enable the 'Show Tutorial' option to see a demo of how to get a client id from google.


The process of getting a client id is as follows. First, go to “https://console.developers.google.com/” and create a new project. After this, under the API manager, click on Credentials and go to OAuth Consent Screen. Fill the product name and save it.


social-site-authentication-odoo10-cybrosys


After it is done, click on Create Credentials and select the option, OAuth Client ID, then select the Web application from the list.


social-site-authentication-odoo10-cybrosys


Fill the Authorized redirect URIs field, like, “http://your_domain_name/auth_oauth/signin”. After this, you will get your client ID. When providing the URI, it is not allowed to enter raw IP address. i.e, like, http://0.0.0.0:8082/auth_oauth/signin. We have to provide a proper domain name or IP address, it should end like .com or .org.


Enter this client ID in Odoo (Settings -> General Settings -> Google Integration -> Google client id).


Now under Settings -> Users, a new menu 'Oauth Providers' will be appeared. Under this menu, we can see the providers list. Now open odoo.com accounts and uncheck the 'Allowed' field. Enable the 'Allowed' field for Google Oauth2. Once it is done, we can create new users and provide the email address. This email address should be the user’s Google account. Under the 'Oauth' tab, select the OAuth provider as Google Oauth2 and save the record.


Now if we go to the login page, we can find a new option for the users to sign in with Google accounts.


social-site-authentication-odoo10-cybrosys


We will be redirected to the google account sign-in page by clicking on the 'Login with Google' link. From here, we can sign into our google account and after we have signed in, we will be redirected to Odoo.


Use Facebook to sign in :


If we need to use Facebook to sign in to Odoo instead of Google, we need to follow these steps. First, we need to obtain a client id from Facebook. For this, go to https://developers.facebook.com/apps and sign in with your Facebook account. We can see our apps here. Add a new app from here. If you are doing this for the first time, then click on the register now button.


social-site-authentication-odoo10-cybrosys

Provide a name and email address for the app and save it. After it is created, we can see the created app and its id.

social-site-authentication-odoo10-cybrosys


Here, ‘Odoo test’ is my app name. Click on the settings to open the settings related to our app. Here we can provide the domain of our Odoo and the complete URL. One thing we have to note is, the domain we are providing should be same as the domain we use in Odoo. Save the changes and copy the app id. Now we can go to our Odoo and open the facebook graph from the OAuth providers menu under settings. Fill the client id field with the app id and tick the field ‘Allowed’.


social-site-authentication-odoo10-cybrosys


Now we can see an option to sign in with facebook on our login page. When we click on that link, we will be redirected to a page where we can sign in to our Facebook and after signing in, we will be redirected to Odoo.


social-site-authentication-odoo10-cybrosys


If you need any assistance in odoo, we are online, please chat with us.



5
Comments

Linto

Hi, have you tried enabling the flag, "auth_signup.allow_uninvited" ? If not, set that to true and try again with a new client id.

25/09/2017

-

1:14AM

Quoc Bao

Hello, Can you demo add config for login with Twiiter ?

17/12/2019

-

8:49PM

Yogesh Kumar

Facebook oauth doesn't show full detail. where is white listed URIs?

14/03/2019

-

4:29AM

Jamoore

@vu hope you have this fixed now. its probably because you are trying to login with the email you have already signed in with at odoo. try another email or a friend's phone ..

07/12/2018

-

2:25AM

Vu Huynh

Hi, I tried to setup google oath with Odoo, but it does not work. I always got error: "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." When create the user and select the OAuth Provider, do we need to provide the OAuth User ID? And how do we know the value. When i debugging in res_users.py, I found the code: oauth_user = self.search([("oauth_uid", "=", oauth_uid), ('oauth_provider_id', '=', provider)]) And user cannot be found Thank you.

03/08/2017

-

2:45AM



Leave a comment



whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message