Package: odoo9-addon-oauth-provider
OAuth ProviderThis module allows you to turn Odoo into an OAuth 2 provider.It’s meant to provide the basic authentication feature, and some data access routes.
But you are encouraged to create custom routes, in other modules, to give structured data for any specific need.InstallationTo install this module, you need to:Install the oauthlib python moduleInstall the module like any other in OdooFor the token retrieval to work on a multi-database instance, you should add this module in the server_wide_modules listConfigurationThis module requires you to configure two things :The scopes are used to define restricted data accessThe clients are used to declare applications that will be allowed to request tokens and dataTo configure scopes, you need to:Go to Settings > Users > OAuth Provider ScopesCreate some scopes:The scope name and description will be displayed to the user on the authorization page.The code is the value provided by the OAuth clients to request access to the scope.The model defines which model the scope is linked to (access to user data, partners, sales orders, etc.).The filter allows you to determine which records will be accessible through this scope. No filter means all records of the model are accessible.The field names allows you to define which fields will be provided to the clients. An empty list only returns the id of accessible records.To configure clients, you need to:Go to Settings > Users > OAuth Provider ClientsCreate at least one client:The name will be displayed to the user on the authorization page.The client identifier is the value provided by the OAuth clients to request authorizations/tokens.The application type adapts the process to four pre-defined profiles:Web Application : Authorization Code GrantMobile Application : Implicit GrantLegacy Application : Resource Owner Password Credentials GrantBackend Application : User Credentials Grant (not implemented yet)The skip authorization checkbox allows the client to skip the authorization page, and directly deliver a token without prompting the user (useful when the application is trusted).The allowed scopes list defines which data will be accessible by this client applicaton.The allowed redirect URIs must match the URI sent by the client, to avoid redirecting users to an unauthorized service. The first value in the list is the default redirect URI.For example, to configure an Odoo’sauth_oauthmodule compatible client, you will enter these values :Name : Anything you wantClient identifier : The identifier you want to give to this clientApplication Type : Mobile Application (Odoo uses the implicit grant mode, which corresponds to the mobile application profile)Allowed Scopes : Nothing required, but allowing access to current user’s email and name is used by Odoo to fill user’s information on signupAllowed Redirect URIs :http://odoo.example.com/auth_oauth/signinUsageThis module will allow OAuth clients to use your Odoo instance as an OAuth provider.Once configured, you must give these information to your client application :Client identifier : Identifies the application (to be able to check allowed scopes and redirect URIs)Allowed scopes : The codes of scopes allowed for this clientURLs for the requests :Authorization request :http://odoo.example.com/oauth2/authorizeToken request :http://odoo.example.com/oauth2/tokenToken information requesthttp://odoo.example.com/oauth2/tokeninfoParameters : access_tokenUser information requesthttp://odoo.example.com/oauth2/userinfoParameters : access_tokenAny other model information request (depending on the scopes)http://odoo.example.com/oauth2/otherinfoParameters : access_token and modelFor example, to configure theauth_oauthOdoo module as a client, you will enter these values :Provider name : Anything you wantClient ID : The identifier of the client configured in your Odoo Provider instanceBody : Text displayed on Odoo’s login page linkAuthentication URL :http://odoo.example.com/oauth2/authorizeScope : A space separated list of scope codes allowed to the client in your Odoo Provider instanceValidation URL :http://odoo.example.com/oauth2/tokeninfoData URL :http://odoo.example.com/oauth2/userinfoKnown issues / RoadmapImplement the backend application profile (client credentials grant type)Add checkboxes on the authorization page to allow the user to disable some scopes for a token ? (I don’t know if this is allowed in the OAuth protocol)Bug TrackerBugs are tracked onGitHub Issues. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.CreditsImagesOdoo Community Association:Icon.ContributorsSylvain Garancher <sylvain.garancher@syleam.fr>MaintainerThis module is maintained by the OCA.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.To contribute to this module, please visithttps://odoo-community.org.