OdooWiki OCA HUB

Auth JWT Test

auth_jwt_demo folder_open OCA/server-auth open_in_new
Uncategorised License: LGPL-3

A test/demo module for auth_jwt.

auto_awesome What this module does

AI-generated from the code · Odoo 18.0

Demo/test module that adds sample web endpoints to try out JWT authentication in Odoo, returning the logged-in user's name and email as JSON.

This is a demonstration module built on top of the JWT authentication module. It does not add menus or screens; instead it exposes a few web addresses (endpoints) that return information about the user identified by a JSON Web Token (JWT), a signed token used to prove identity.

  • /auth_jwt_demo/whoami returns the name and email of the partner linked to the token, plus the user id.
  • /auth_jwt_demo/whoami-public-or-jwt works either with a valid token or anonymously, returning the user id and, when a token is present, the partner's name and email.
  • /auth_jwt_demo_cookie/whoami and /auth_jwt_demo_cookie/whoami-public-or-jwt do the same but accept the token stored in a cookie.
  • /auth_jwt_demo/keycloak/whoami and /auth_jwt_demo/keycloak/whoami-public-or-jwt are meant to be used with a Keycloak identity provider; the public version returns "Anonymous" when no token is supplied.

All responses are JSON and the endpoints allow cross-origin requests. The module also loads demo data: three JWT validators named demo, demo_cookie and demo_keycloak, configured with an audience, an issuer, a signing secret or public key, and rules that pick the Odoo user and partner from the token. These are sample configurations for testing, not production settings.

Depends on

Required by other modules

Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 4 confirmed, 5 with no information of 9 versions.

Sources · Odoo 18.0

Confirmed on 2026-11-03 in branch 18.0 of OCA/server-auth.

terminal Installation and usage

OCA documentation · Odoo 18.0

This modules creates a JWT validator named demo, and adds a /auth_jwt_demo/whoami route which returns information about the partner identified in the token.

The whoami endpoint can be invoked as such, assuming python-jose is installed.

# /usr/bin/env python3
import time

import requests
from jose import jwt

token = jwt.encode(
    {
        "aud": "auth_jwt_test_api",
        "iss": "some issuer",
        "exp": time.time() + 60,
        "email": "mark.brown23@example.com",
    },
    key="thesecret",
    algorithm=jwt.ALGORITHMS.HS256,
)
r = requests.get(
    "http://localhost:8069/auth_jwt_demo/whoami",
    headers={"Authorization": "Bearer " + token},
)
r.raise_for_status()
print(r.json())

No verified information in OCA: Installation, Configuration.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.