Pragmatic – Leading provider of open source business applications OpenERP, Ruby on Rails, Node.js, Talend, jaspersoft  – Pragmatic
Beyonce Adams

How to set up OAuth authentication and integrate Facebook login with Odoo 18 | A complete step-by-step guide

Why Facebook Login in Odoo 18?

Let’s suppose your users land on your Odoo portal and, instead of fumbling with yet another password, they simply click “Log in with Facebook.” It’s fast, familiar and secure. 

Integrating Facebook login with Odoo 18 via OAuth authentication means less friction, fewer forgotten passwords and a more modern user experience. 

Plus, you leverage Facebook’s robust security and authentication protocols, giving your users peace of mind and your business a professional edge.

Understanding OAuth Authentication in Odoo

OAuth is an open standard for access delegation – think of it as a secure handshake between your Odoo system and Facebook. 

When a user chooses to log in with Facebook, Odoo redirects them to Facebook, where they authenticate. Facebook then sends a secure token back to Odoo, confirming the user’s identity—no passwords exchanged, no sensitive data stored unnecessarily.

Prerequisites : What You Need Before You Start

Before we dive in, make sure you have –

  • An Odoo 18 instance with admin access
  • A Facebook Developer account
  • An SSL-enabled domain (Facebook requires HTTPS for OAuth)
  • Odoo’s “OAuth Authentication” module installed
  • Developer mode enabled in Odoo

Having these ready will make the process smooth and frustration-free.

Step 1 : Creating Your Facebook App for OAuth

  • Let’s start at the source – Facebook
  • Log in to Facebook for Developers
  • Go to Facebook for Developers and sign in with your Facebook account.
  • Create a New App
  • Click “Create App.”
  • When prompted, select “Others” as the purpose and “Consumer” as the app type.
  • Enter a name for your app (e.g., “Odoo 18 Auth”) and click “Create app.”
  • Add Facebook Login Product
  • In the app dashboard, find “Add Product.”
  • Select “Facebook Login” and click “Set Up.”
  • Choose “Web” as the platform.
  • Configure Basic App Settings
  • Go to “Settings” > “Basic.”
  • Fill in :
  1.  App Domain : Your Odoo instance’s domain (e.g., https://your-odoo-domain.com)
  2. Privacy Policy URL : A valid privacy policy (you can generate one at privacypolicies.com)
  3. User Data Deletion URL : Typically https://your-odoo-domain.com/auth_oauth/signin
  4. Category : Pick the most relevant category for your app
  • Switch Your App to Live Mode
  • In the left menu, find “App Review” and toggle your app from Development to Live. This is crucial for public access.

Step 2 : Configuring Facebook Login Settings

Now, let’s set up the OAuth redirect :

  • Go to Facebook Login Settings
  • In your app dashboard, under “Facebook Login,” click “Settings.”
  • Enter the Valid OAuth Redirect URI
  • Add : https://your-odoo-domain.com/auth_oauth/signin. This tells Facebook where to send users after they authenticate.
  • Save Changes. Double-check the URI for typos—this is a common source of errors! Click “Save.”

Step 3 : Setting Up OAuth in Odoo 18

Let’s switch to your Odoo backend :

  • Install the OAuth Authentication Module
  • Go to “Apps” in Odoo.
  • Search for “OAuth Authentication.”
  • Click “Install.” This module enables Odoo to communicate with external OAuth providers like Facebook.
  • Enable OAuth Authentication
  • Navigate to Settings.
  • Scroll to the Integrations section and tick the “OAuth Authentication” checkbox.
  • Click “Save”.
  • Activate Developer Mode
  • In Settings, click “Activate the developer mode” (usually found at the bottom of the page).

Step 4 : Linking Facebook with Odoo (OAuth Provider Setup)

Now, let’s connect the dots :

  • Access OAuth Providers
  • Go to Settings > Users & Companies > OAuth Providers.
  • Configure the Facebook Graph Provider
  • If “Facebook Graph” is listed, click it. If not, create a new provider.
  • Enter :
  1. Name: Facebook
  2. Client ID : Your Facebook App ID
  3. Client Secret : Your Facebook App Secret
  4. Allowed : Make sure this is checked
  5. Set the Authorization and Token URLs
  6. These are usually pre-filled, but double-check :
  7. Authorization URL: https://www.facebook.com/dialog/oauth
  8. Token URL: https://graph.facebook.com/oauth/access_token
  9. Data URL: https://graph.facebook.com/me?fields=id,name,email
  10. Save Your Changes : Click “Save.” Facebook login should now appear as an option on your Odoo login page.

Step 5 : Testing Your Facebook Login Integration

The moment of truth!

  • Log Out of Odoo
  • Go to the Odoo Login Page
  • Click “Log in with Facebook”
  • Authorize the App on Facebook
  • You’re Redirected Back to Odoo, Logged In

If everything’s set up correctly, you’ll see a new user created in Odoo with your Facebook email, or your existing user will be linked.

Try it with a test account first to make sure everything flows smoothly.

Troubleshooting & Common Pitfalls

1) Redirect URI Mismatch 
Double-check that the URI in Facebook matches your Odoo instance exactly – no trailing slashes or typos.

2) App Still in Development Mode
If your app isn’t live, only admins and testers can use it. Switch to Live mode for public access.

3) SSL Requirement
Facebook OAuth only works with HTTPS. Make sure your domain is SSL-enabled.

4) Missing Email Permission
If users don’t have an email on Facebook or you haven’t requested the right permissions, Odoo may not link accounts correctly.

5) Clear Browser Cache
Sometimes, browser caching can cause weird issues – clear your cache if you run into unexpected problems.

Best Practices for Secure OAuth Integration

1) Keep Your App Secret Confidential
Never share your Facebook App Secret or expose it in client-side code.

2) Limit App Permissions

Only request the permissions you truly need from Facebook.

3) Monitor Login Activity

Regularly check Odoo’s user logs for suspicious login attempts.

4) Update Regularly

Keep both Odoo and your Facebook app up-to-date for the latest security patches.

5) Document Your Process

Make a note of your configuration steps for future reference or team members.

Setting up OAuth authentication and Facebook login in Odoo 18 can feel overwhelming, especially if you’re new to OAuth or managing a live business platform.

If you need tailored advice, troubleshooting or want to explore even more advanced integrations, our team at Pragmatic is here to help.

Let’s make your Odoo experience seamless, secure and future-ready. 

FAQs

Q1: Can I enable Facebook login for both internal and portal users in Odoo 18?
Yes, you can configure Facebook OAuth for any user type by adjusting the OAuth provider settings in Odoo.

Q2: What happens if a user’s Facebook email matches an existing Odoo account?
Odoo will link the accounts, allowing seamless login with either method.

Q3: Is it possible to customize the Facebook login button on the Odoo login page?
Absolutely! You can modify the login page using Odoo’s website builder or custom modules for a branded experience.

Q4: Do I need to pay extra for Facebook OAuth integration in Odoo?
No, both Odoo’s OAuth feature and Facebook Login are free to use.

Q5: What if I want to support other social logins like Google or LinkedIn?
Odoo’s OAuth framework supports multiple providers. Just repeat the process with the relevant app credentials.

SHARE | FOLLOW | SUBSCRIBE

Leave a Reply

Subscribe to Blog via Email.

Enter your email address to subscribe to this blog and receive notifications of new posts by email.
Loading

Recent Comments

Related Posts