Skip to Content
Menu

API JWT Authentication

by
Odoo

135.77

v 16.0 Third Party 33
Live Preview
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Community Apps Dependencies
Lines of code 1025
Technical Name api_auth_jwt
LicenseOPL-1
Websitehttps://ekika.co
Versions 12.0 13.0 14.0 15.0 16.0 17.0 18.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 1025
Technical Name api_auth_jwt
LicenseOPL-1
Websitehttps://ekika.co
Versions 12.0 13.0 14.0 15.0 16.0 17.0 18.0
Versions 12.0 13.0 14.0 15.0 16.0 17.0 18.0
Community
Enterprise

https://www.ekika.co/support

JWT Authentication

This module serves as a fundamental component within the API Framework, enabling JWT-based authentication for secure access. To incorporate JWT authentication into your API configuration, integrating this module is a necessary step. It provides the foundational mechanisms required for managing and validating JWT tokens, ensuring that only authenticated requests are granted access to protected endpoints.

Overview

JWT (JSON Web Token) authentication provides a robust and stateless way to secure API endpoints. It ensures that only authorized users can access API resources by requiring the client to include a token in the request headers. An Odoo Implementation of RFC 7519. (Thanks to Mr. José Padilla)

How It Works

When accessing an API endpoint secured with JSON Web Token (JWT) authentication, clients need to include an Authorization header in the request, containing the JWT token provided by the server. This token, which serves as proof of authentication, is typically issued during the initial login process. Once authenticated, the server generates a JWT and returns it to the client, which must then include this token in the Authorization header of each subsequent request to ensure access to protected resources. The token acts as a credential that validates the client's identity and permissions, allowing the server to verify that the requester is authorized to perform the requested actions without requiring additional login steps each time.

Headers

Key Value
Authorization Bearer Your-JWT-Token

Configuring JWT Authentication

IconSpecify the authentication type as JWT for using JSON Web Tokens (JWT).

API JWT Auth Setting

IconThe Authentication Configuration tab is visible when the API is in the OPEN/PUBLISHED state.

API JWT Auth Setting

IconSelect a JWT algorithm from the list of available options.

API JWT Auth Setting

IconProvide the JWT token's expiration time in hours.

API JWT Auth Setting

IconUse the "UPDATE JWT KEYS" button to create or refresh JWT keys according to the chosen algorithm.

API JWT Auth Setting

IconAs shown in the image below, JWT keys are generated according to the chosen algorithm(RS256) when the "UPDATE JWT KEYS" button is clicked.

API JWT Auth Setting

IconAs shown in the image below, JWT keys are generated according to the chosen algorithm(HS256) when the "UPDATE JWT KEYS" button is clicked.

API JWT Auth Setting

Login Using JWT

IconBelow Image Shows the jwt login request in postman

JWT Login Postman

Here's an example using Python:

import requests
import json

url = "http://localhost:8016/gql_jwt/api/jwt/auth/login"

payload = json.dumps({
"login": "admin",
"password": "admin"
})
headers = {
'Content-Type': 'application/json',
}

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

print(response.text)

Fetch Data Using JWT Authentication

IconBelow Image Shows the jwt fetch data request in postman

JWT Login Postman JWT Login Postman

Here's an example using Python:

import requests
import json

url = "http://localhost:8016/gql_jwt"

payload = "{\"query\":\"query MyQuery {\\n    SaleOrder {\\n        id\\n        name\\n    }\\n}\",\"variables\":{}}"
headers = {
'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsIm5hbWUiOiJNaXRjaGVsbCBBZG1pbiIsImV4cCI6MTczMDIyNzYwM30.wbcAM5Ps-qvPvLkW-IJX7iODHXQo1Ps6-14Hiq4FClE',
'Content-Type': 'application/json'
}

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

print(response.text)

Frequently Asked Questions (FAQs)

Find answers of common questions you might have about this addon. If you don't see your question addressed here, feel free to contact us!

Contact Us:

  • Whats App / Phone: +919510031431 -- URGENT
  • EMail: hello@ekika.co
  • Skype: amshukla17
  • Website: https://ekika.co
  • Support Ticket: https://ekika.co/support -- Get Notifications of Progress.
  • 24 x 7 Available! Contact us NOW.

We love hearing your ideas for improvement! If you have a feature in mind that would make your Odoo experience even better, simply contact us. We're happy to discuss your needs and explore the best way to implement them.

We offer a wide range of Odoo services to help you at any stage, from initial setup ("implementation") to ongoing customization and support. This includes:

  • Adding new features and functionalities ("addons development")
  • Changing behaviour of whole system ("server and structure level changes")
  • Server maintenance and configuration changes ("nginx / filestores / size issues etc.")
  • Integration with other systems
  • RESTful APIs, WebHooks, Slave-Master DB, Real-time data communication ("socket connection") etc.
  • Improving app performance and user experience ("performance tuning" and "UI/UX design")
  • Secure and reliable managed hosting solutions
  • Annual maintenance contracts to keep your Odoo running smoothly and so much more...

Basically, we're your one-stop shop for all things Odoo! We offer premium services at competitive rates.

Need Help?

EKIKA Has Your Back - 24/7 Support.

We're just a message away, no matter the time zone.

90 Days Free Support

We understand that even with great documentation, you might have questions or need additional assistance. That's why we offer exceptional support.

https://ekika.co/api
Documentation & User Guide
(copy link to clipboard)
https://www.youtube.com/@ekika_co/videos
Video Guide
(copy link to clipboard)
https://ekika.co/support
Support
(copy link to clipboard)

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!

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.