Package: docebo-sso
This package is meant to allow a simple python interface to add a third
party Single Sign On to the Docebo Learning Management System. Docebo’s
SSO does not create a user that doesn’t exist, or update the credentials
of a user that does exist.UsageThere are two ways to use this package, depending on the amount of
customization that you need with Docebo’s sign on.User APIThe user API is a simple, flexible set of methods to sync a Docebo user
with a locally created user object. To ue the methods, the User object
must first be instantiated with all of the information to be synced with
the user from DoceboA full list of valid user parameters can be found at Docebo’s API
reference:https://www.docebo.com/wp-content/uploads/media/Docebo_APImanual.pdffromdocebo_ssoimportuserasdocebo_usernew_user=docebo_user.User(userid='batman',firstname='john',lastname='Doe',...)Next, the API and SSO keys and the hosting domain for your LMS must be
initialized. This method will also create the appropriate hashes and
tokens necessary for using Docebo’s APIdocebo_user.initialize_keys(domain='http://example.docebosaas.com'api_key='xxxxxxxxxx'api_secret='xxxxxxxxxx'sso_token='xxxxxx')Finally, you can use the methods in the User api to interact with Docebo
– the methods use the parameters you input into the User object and
generate valid params/api_keys.ifnew_user.exists():new_user.update()else:new_user.create()redirect_url=new_user.signin()The above is a simple script to create the local user initialized in the
first step if their userid doesn’t exist on Docebo, and update their
user parameters if they do exist.redirect_url will contain a valid, signed, URL to signin to that user’s
account on Docebo that can be redirected to or pasted into a browser.Available methods are:Allofthesemethodsreturnbooleanvaluesforsuccessforeasycontrolflowfromdocebo_ssoimportuserasdocebo_user# Initialize user object with keys, secrets and domaindocebo_user.initialize_keys(self,domain,api_secret,api_key,sso_secret)# Verify user exists in Docebo (by username)
# Hits /api/user/checkUsernameexists(self)# Update remote user params from local user informationupdate(self)# Create a new user based on local user
# Hits /api/user/createcreate(self)# Delete user
# Hits /api/user/deletedelete(self)# Sign user in (if account exists), and return URL which will sign that user into their docebo accountsignin(self)In order to call delete or update, the docebo unique-id for that given user is required.create() and exists() automatically add this field on successYou can also use the following method to add the uid manually.new_user.set_docebo_unique_id(#####)Methods APIThe second method of interaction is less abstracted, but gives more
control over the params. Where the User API generates params and fills
in information for the user, the Methods API requires the user to input
a set of params as a dictionary at every call.The correct format for the params generated for each method can be found
at:https://www.docebo.com/wp-content/uploads/media/Docebo_APImanual.pdfThe api_key, api_secret and sso_secret must still be initialized as
in the User API.Available methods are:fromdocebo_ssoimportmethodsasdocebo_methods#These methods return the json body of the responses they receive.# Verify user exists in Docebodocebo_methods.verify_user(self,params)# Update user params w/input paramsdocebo_methods.edit_user(self,params)# Create a new user given input params
# Gives an 'empty response' error if user already existsdocebo_methods.create_user(self,params)# Delete user corresponding to provided unique_iddocebo_methods.delete_user(self,params)# Sign user in (if account exists), and return URL which will sign that user into their docebo accountdocebo_methods.setup_valid_docebo_sso_path_and_params(self,username)