API OAuth2 Authentication

by
Odoo

59.07

v 17.0 Third Party 3
Live Preview
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Community Apps Dependencies
Lines of code 1172
Technical Name api_auth_oauth2
LicenseOPL-1
Websitehttps://ekika.co
Versions 16.0 17.0
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Community Apps Dependencies
Lines of code 1172
Technical Name api_auth_oauth2
LicenseOPL-1
Websitehttps://ekika.co
Versions 16.0 17.0
Supported Versions 16.0 17.0
Community
Enterprise

https://www.ekika.co/support

OAuth2.0 Authentication

OAuth 2.0 Authentication for APIs

Introduction

OAuth2 stands for "Open Authorization 2.0". It is the second version of the OAuth protocol, which is an open standard for access delegation commonly used for API authentication and authorization. OAuth 2.0 is a widely used authorization framework that allows applications to securely access resources on behalf of users without needing their credentials. It's commonly used for API authentication in web and mobile applications. OAuth 2.0 uses Access Tokens, an Access Token is a piece of data that represents the authorization to access resources on behalf of the end-user.

How It Works:

The API OAuth2 Authentication module for Odoo integrates the OAuth2 authorization coupled with api framework, ensuring secure API access with the authorization-code-grant flow of the specification. It provides seamless management of client authentication and token lifecycle, making it an essential component of the API bundle. This module enhances the security and functionality of your Odoo API integrations.

Benefits

  • Enhanced security with OAuth2 standards.
  • Simplified client authorization.
  • Comprehensive token management.
  • Seamless integration with Odoo.
  • Developer-friendly with clear examples.
  • Reliable access control.
  • Scalable for businesses of all sizes.

Usage

  • Secure API integration with third-party applications.
  • Protect sensitive data accessed via APIs.
  • Streamline OAuth2 authentication processes.
  • Automate token lifecycle management, including issuance, refresh, and revocation.
  • Simplify the development and deployment of secure API endpoints.

Authorization and Token Related Steps:

  • First, client register redirect-uri, which is provided in api record form, to its respected provider.
  • Client has to made request to "/<api>/oauth2/provider/authorize" with its client_id in request-body(json), which returns authorization_url in json-body from response.
  • When client use this authorization_url, client has to authorize with its respected user, after successful authorization server returns token information.
    Which includes:
    • access_token, refresh_token, expires_in, expires_at, scope, token_type, id_token. Note: This differs from provider to provider.
    • db, login
  • If client wants to refresh the token & get access-token then made request to "/<api>/oauth2/token" with its client-id, client-user-identity in request-body(json), which returns new token related information.
  • If client wants to revoke the token then made request to "/<api>/oauth2/revoke" with its client-id, client-user-identity in request-body(json), which revoke the token from authorization server and also delete the client api user record.

API Resource Access Steps:

  • When client want fetch api data using oauth2 method, made http-request using header: Authorization: Bearer access_token_value
  • If access_token is valid then it return response data and if access_token is invalid then client has to refresh the token or authorize the user again.

Python Request Examples:

1. Client Authorization:

  import requests
  import json

url = "https://easyapi.ekika.app/jsonapiext/oauth2/provider/authorize"

payload = json.dumps({
  "client_id": "YOUR_CLIENT_ID",
  "client_user_identity": "YOUR_UNIQUE_CLIENT_IDENTITY"
})

headers = {
  'Content-Type': 'application/json'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

2. Refresh Token:

import requests
import json

url = "https://easyapi.ekika.app/jsonapiext/oauth2/token"

payload = json.dumps({
  "client_id": "YOUR_CLIENT_ID",
  "client_user_identity": "YOUR_UNIQUE_CLIENT_IDENTITY"
})

headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

3. Revoke Token:

import requests
import json

url = "https://easyapi.ekika.app/jsonapiext/oauth2/revoke"

payload = json.dumps({
  "client_id": "YOUR_CLIENT_ID",
  "client_user_identity": "YOUR_UNIQUE_CLIENT_IDENTITY"
})

headers = {
  'Content-Type''application/json'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

RoundConfiguring API OAuth2 Authentication

Auth OAuth 2.0 Configure Setting Auth OAuth 2.0 Configure Setting Auth OAuth 2.0 Configure Setting

Services EKIKA Provides

EKIKA is your destination for expert Odoo ERP implementation and customization. We pride ourselves on building reliable, trust-based partnerships that give you full transparency and control over your business processes.

With over 12 years of experience, we can assist you with eCommerce platforms, production planning, point-of-sale systems, managing inventory adjustments, and providing advanced field worker tracking solutions to optimize your workflows and boost operational efficiency.

Ekika Odoo Implementation

Implementation

Utilise Odoo ERP tailored for your business needs for smooth operations.

Ekika Odoo Customization

Customization

Personalized adjustments to Odoo modules for seamless management.

Ekika Odoo Support

Support

Ongoing assistance and maintenance to optimize your Odoo system's performance.

Are you struggling with disorganized operations, high operational costs, or lack of transparency in your processes? What sets us apart is our commitment to personalized solutions tailored to your unique business needs and our proactive support, ensuring seamless integration and ongoing success.

Would you like to explore Odoo ERP for your business? Schedule a free consultation with EKIKA today!

Click here to see main "API Framework" module.
EKIKA API Framework
Odoo Proprietary License v1.0

This software and associated files (the "Software") may only be used (executed,
modified, executed after modifications) if you have purchased a valid license
from the authors, typically via Odoo Apps, or if you have received a written
agreement from the authors of the Software (see the COPYRIGHT file).

You may develop Odoo modules that use the Software as a library (typically
by depending on it, importing it and using its resources), but without copying
any source code or material from the Software. You may distribute those
modules under the license of your choice, provided that this license is
compatible with the terms of the Odoo Proprietary License (For example:
LGPL, MIT, or proprietary licenses similar to this one).

It is forbidden to publish, distribute, sublicense, or sell copies of the Software
or modified copies of the Software.

The above copyright notice and this permission notice must be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author or have a question related to your purchase, please use the support page.