Skip to main content

Database auth setup

Authentication and SSO

The database authentication app enables your users and/or agents to log in using credentials stored in a database you control.

This is useful if you have a database-driven system (like a website) with user accounts, and you want users to be able to use their existing accounts stored in the database.

The supported database types are:

  • MySQL
  • PostgreSQL
  • SQLite
  • MsSQL
  • Oracle
  • ODBC connections

Your database must contain the user account information in a single table with these fields:

  • unique ID (required)
  • email address (required)

These fields are optional:

  • password
  • username
  • first name
  • last name
  • full name

You can optionally enable Auto Sync, so that Deskpro accounts are regularly updated with the latest information from your database. If you select this option, data will automatically be pulled from the database daily at 1am (as well as when you manually choose to sync, which you can do at any time).


Auto Sync for database sources is in beta. It may not work for all database types.

  1. Go to Agents > Auth & SSO or CRM > Auth & SSO, depending on whether you want to use database authentication for agents or users.
  2. Click + Add then click on the Database app.
  3. Enter the requested settings.
  4. (Agent authentication only) Set the Auto agent option. This determines which agent permission group is used for agents created from the database.
  5. (User authentication only) Set the Grant usergroup option. This controls the usergroup granted to users who are created from the database.
  6. Click Test Settings, then Install App.

If your password field is using any kind of hashing (sha1, md5, etc) you need to make sure that this line is added to the file config.settings.php

$SETTINGS['database_authentication_php'] = '$is_valid = (strtolower(sha1($password_input)) == strtolower($password_recorded));';

Increasing sync speed

If you are using Deskpro On-Premise and find that syncing is taking a long time, you can increase the speed of the sync process by increasing the PHP memory limit.

Edit your php.ini file to set the value for memory_limit to “256M”.

Filtering user records

If you only want to use a subset of the records in your database, use the new Filtering a usersource feature.

Note that you can install multiple versions of the database app if you want to authenticate different groups of users with different permissions.

Additional user data

Your usersource may have additional user data beyond the user’s email address and password: for example, employee numbers, location information, etc.

You can set up Deskpro to copy this data into a custom user field so it is available in your helpdesk when you view each user’s profile.

  1. Make sure the authentication app for the desired usersource is installed in Deskpro and working correctly.

  2. If you have an On-Premise helpdesk on Deskpro build #430 or earlier, open config.phpin the Deskpro install folder.

    Edit this line:

    $DP_CONFIG['debug']['enable_usersource_log'] = false;

    to say

    $DP_CONFIG['debug']['enable_usersource_log'] = true;

    This step is not required on later Deskpro versions.

  3. Go to Admin > CRM > Auth & SSO (or Admin > Agents > Auth & SSO) and select the app.

  4. Click the Test Settings button. Enter some login credentials for a user in the external usersource which you know are valid.

  5. You will see a results page.

    Click Show user data.

    You will see an encoded list of values that are returned from the usersource.

    Make a note of the field name for the value you want to copy into your helpdesk (ignoring any square brackets around it).

    Here’s a sample excerpt from an Active Directory app:


    In this case, if you wanted to import the highlighted value, you would use telephonenumber as the field name.

  6. Go to Admin > CRM > Fields > User. Click Add button and choose the “User Auth Data” field type.

    Fill in the title and description.

    In Field Name, enter the name of the field as returned from your usersource in step 4.


    You can optionally choose to make the field specific to a particular authentication app.

    Click Save.

  7. Repeat for any other data fields you require.

If you edited the $DP_CONFIG['debug']['enable_usersource_log'] value in step 2, change it back to false once you are finished.

Working with data collections

If your usersource returns collections of data (e.g., arrays of nested data), you can access sub-elements of a collection by using “dot notation”. For example, given this collection of values:

[example] => Array(
    [inner] => Array(
        [value1] => Hello
        [value2] => World

You can gain access to the “World” value by using the field name “example.inner.value2”.

If you omit the last part of a collection name, Deskpro will automatically concatenate all values together as a single string.

Authors list

First published: 24/03/2017

Last updated: Oct 4, 2019 by Hugo Pinto