Skip to main content

Login/logout from session using a REST call

Project description

Alpha License: LGPL-3 OCA/rest-framework Translate me on Weblate Try me on Runboat

This module adds API endpoints to deal with session authentication and logout.

Table of contents

Usage

Authentication

To authenticate you need to POST a request on [ODOO HOST]/session/auth/login with the following body:

{
    "db": [DB_NAME],
    "login": [LOGIN],
    "password": [PASSWORD]
}

"db" is not mandatory if Odoo is able to determine it unequivocally (e.g. single database server or dbfilter parameter). If the authentication is successful, the response will contain (in addition to the usual response of the JSON-RPC authentication):

{
    ...
    "session": {
        "sid": "ff6b4bac7a590e7960abfc0ac38361433ecac1d6",
        "expires_at": "2021-09-21 16:53:56"
    }
}

This sid value can then be sent in subsequent requests in the following ways:

  • header X-Openerp-Session-Id

  • cookie named session_id

  • request param session_id

Logout

To logout you need to POST a request on [ODOO HOST]/session/auth/logout with an empty body.

Changelog

14.0.1.0.0

First official version.

15.0.1.0.0

Second version.

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Wakari

Contributors

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

This module is part of the OCA/rest-framework project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

File details

Details for the file odoo_addon_base_rest_auth_user_service-15.0.1.0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo_addon_base_rest_auth_user_service-15.0.1.0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2e223f8d0b6c8c3e06354f1e2c5469436879398c28b62b6be92e586c2eaace04
MD5 9bb257fc8c652003a7b3d05b05501d67
BLAKE2b-256 9bd9e82d77ad5b5a982fd481e06682cb3911c8010c64370de0e0267ba930cd34

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page