Skip to content
Snippets Groups Projects
  • std-odoo's avatar
    1e1a494a
    [ADD] fetchmail_outlook, microsoft_outlook: add OAuth authentication · 1e1a494a
    std-odoo authored
    Purpose
    =======
    As it has been done for Gmail, we want to add the OAuth authentication
    for the incoming / outgoing mail server.
    
    Specifications
    ==============
    The user has to create a project on Outlook and fill the credentials
    in Odoo. Once it's done, he can create an incoming / outgoing mail
    server.
    
    For the authentication flow is a bit different from Gmail. For Outlook
    the user is redirected to Outlook where he'll accept the permission.
    Once it's done, he's redirected again to the mail server form view and
    the tokens are automatically added on the mail server.
    
    Technical
    =========
    There are 3 tokens used for the OAuth authentication.
    1. The authentication code. This one is only used to get the refresh
       token and the first access token. It's the code returned by the user
       browser during the authentication flow.
    2. The refresh token. This one will never change once the user is
       authenticated. This token is used to get new access token once they
       are expired.
    3. The access token. Those tokens have an expiration date (1 hour) and
       are used in the XOAUTH2 protocol to authenticate the IMAP / SMTP
       connection.
    
    During the authentication process, we can also give a state that will
    be returned by the user browser. This state contains
    1. The model and the ID of the mail server (as the same mixin manage
       both incoming and outgoing mail server)
    2. A CSRF token which sign those values and is verified once the browser
       redirect the user to the Odoo database. This is useful so a malicious
       user can not send a link to an admin to disconnect the mail server.
    
    Task-2751996
    
    X-original-commit: e54d63b3c0f39fd8a05e430442cf84d1d6c8de78
    Part-of: odoo/odoo#87498
    1e1a494a
    History
    [ADD] fetchmail_outlook, microsoft_outlook: add OAuth authentication
    std-odoo authored
    Purpose
    =======
    As it has been done for Gmail, we want to add the OAuth authentication
    for the incoming / outgoing mail server.
    
    Specifications
    ==============
    The user has to create a project on Outlook and fill the credentials
    in Odoo. Once it's done, he can create an incoming / outgoing mail
    server.
    
    For the authentication flow is a bit different from Gmail. For Outlook
    the user is redirected to Outlook where he'll accept the permission.
    Once it's done, he's redirected again to the mail server form view and
    the tokens are automatically added on the mail server.
    
    Technical
    =========
    There are 3 tokens used for the OAuth authentication.
    1. The authentication code. This one is only used to get the refresh
       token and the first access token. It's the code returned by the user
       browser during the authentication flow.
    2. The refresh token. This one will never change once the user is
       authenticated. This token is used to get new access token once they
       are expired.
    3. The access token. Those tokens have an expiration date (1 hour) and
       are used in the XOAUTH2 protocol to authenticate the IMAP / SMTP
       connection.
    
    During the authentication process, we can also give a state that will
    be returned by the user browser. This state contains
    1. The model and the ID of the mail server (as the same mixin manage
       both incoming and outgoing mail server)
    2. A CSRF token which sign those values and is verified once the browser
       redirect the user to the Odoo database. This is useful so a malicious
       user can not send a link to an admin to disconnect the mail server.
    
    Task-2751996
    
    X-original-commit: e54d63b3c0f39fd8a05e430442cf84d1d6c8de78
    Part-of: odoo/odoo#87498
energy_communities NaN GiB