Creating and Signing-In Users Automatically in DayBack For FileMaker

Introduction

Typically, you would invite users into your DayBack group just like any other online application. Users receive a welcome email with their username (their email address) and a temporary password, which they can change upon their first login.

However, if you've tightly integrated DayBack into your FileMaker application, you may not want users to go through the additional step of logging into DayBack after they’ve already logged into your app. Previously, you could include a user token in your web viewer to automatically log users in, but this could be tedious since you needed to retrieve a user token from DayBack for each individual user.

With the latest updates to DayBack, you can now use a group token in your web viewer. This group token will automatically create new users if they don't already exist and log in existing users seamlessly. There's no need for users to log in manually, and you don’t have to invite each user individually. As long as you have enough licenses purchased for all the users in your group, everything is ready to go. (Note: The group token itself does not increase the number of users you're paying for on your license, but it does allocate those licenses to new users as they access DayBack.)

If you wish to automatically increase the number of user licenses as needed, you can enable Automatic License Management in DayBack's settings.

Remember, DayBack needs named users, and you probably don't want different users sharing the same DayBack account.

How this works

To integrate DayBack with your FileMaker users, you need a unique identifier for each user. This could be a user's email address, user ID, account name, or another unique string. Whether you have a dedicated users table, flag certain contacts as users, or simply use unique FileMaker accounts, any method works as long as you can uniquely identify each user.

Here’s how it works:

  1. Identify Your Users: Determine the unique string that identifies each user. This identifier will be passed into DayBack via your web viewer's URL (instructions on how to do this are provided below).
  2. Pass in a Group Token: Along with the unique user identifier, you’ll include a token that identifies your DayBack group. DayBack will use these two pieces of information to look up the user in your group each time they open DayBack within your FileMaker app.
  3. Automatic User Login: If DayBack finds a matching user in your group, it will automatically log them in (note that users must have already logged into your app to access the web viewer). If DayBack doesn’t find a matching user in your group, it will create a new user for them, provided you have an available user license.
  4. User Management: Users created this way are treated as regular users, just as if you had manually invited them. You can manage and deactivate these users through the group settings. New users will be set up as regular users (not admins), but you can upgrade them to admins in group settings if needed.
  5. FileMaker Integration: When a user opens DayBack and logs in with a FileMaker account, you will run a script on startup that finds the corresponding user record or FileMaker account. This script will set the necessary data from the matching record into global variables that DayBack can access. Once this script is in place, you can proceed with the steps to integrate the user with DayBack.

The "UserEmail"

While you can use any unique identifier for your users, DayBack expects this identifier to be in the form of an email address. If you’re using a real email address, that’s perfect. However, if you’re using an ID or account name, consider converting it into a unique email format. For example, a user ID could be transformed into something like [email protected] , or an account name could become [email protected] . This ensures each identifier is unique and compatible with DayBack's requirements.

Setting this up in your file

This process is straightforward, but please make sure to back up your FileMaker file(s) before proceeding. It's always best to follow professional practices.

Step 1: Prepare the Admin Account

  1. Sign in to DayBack as an admin for the group you're setting up. If you're a developer doing this for a client, you'll need to create at least one admin account for that group. Decide whether you want to provide your client with the admin account details or manage their DayBack account yourself.
  2. Access the Group Token:
  • After signing in, navigate to the Settings tab, then to Administrator Settings.
  • Click on Me: <account name> and copy the Group Token.
  • Temporarily paste this token somewhere safe, as you will need it later. This token will be used to add new users automatically and log users into the group.

Step 2: Edit the DayBack Layout

  1. Open the DayBack Layout:
  • Open the DayBack FileMaker file associated with the group and navigate to the DayBack layout.
  • Enter Layout Mode and double-click on the web viewer object to edit it.
  1. Add URL Parameters:
  • Several URL parameters can be added to the web viewer URL. The userGroupToken and userEmail are required, while userFirstName and userLastName are optional but recommended.
  • Locate the line within the let statement that starts with url = host & baseParameters and add the following after it:
& "&userGroupToken=<TheGroupToken>&userEmail=" & 
GetAsURLEncoded ( <UserEmail> ) & "&userFirstName=" &
GetAsURLEncoded ( <FirstName> ) & "&userLastName=" &
GetAsURLEncoded ( <LastName> )
    • Replace the placeholders (<TheGroupToken>, <UserEmail>, <FirstName>, <LastName> ) with global variables or field references as appropriate.
    • Remember that UserEmail is case-sensitive, so ensure consistency when creating and using the account.
    • For the userGroupToken, paste the string you copied in Step 1.

      Example:

&"&userGroupToken=C1L1D1L1A1SAEW3JRSSPTTRMUQUJQTPQMUUUNOC1T1H1CZ1E1z1zS1E1CM1AJ1VSISMY86SJ1N1CNJTRO1CS1A1A1BPV1DPC1B1QGFSJKWMEB78SSFS9SHJ4SSD&userEmail=" & 
GetAsURLEncoded ( $$UserEmail ) & "&userFirstName=" &
GetAsURLEncoded ( $$UserFirstName ) & "&userLastName=" &
GetAsURLEncoded ( $$UserLastName )
    • The GetAsURLEncoded function ensures that any special characters in the variables are properly encoded for the URL.
  1. Finalize the Changes:
  • Click OK to save the changes to the web viewer, and then OK again to exit the layout mode.
  • Enter Browse Mode and save the layout changes.

Step 3: Test the Setup

Now, whenever the file is opened, it will automatically sign the user in based on their unique email address. If the user already has a DayBack account, they’ll be signed in. If they don’t have an account, a new one will automatically be created for them.

Additional URL parameters: user permissions

Along with the userFirstName and userLastName parameters mentioned earlier, you can include several other parameters in the URL to define the user's permissions within DayBack.

  • userAdmin: This parameter makes the user a DayBack Admin, giving them access to admin settings, the ability to create and delete users, manage billing, and more. If this parameter is not included, the default value is "false" . Set it to "true" if you want the user to have admin privileges.
  • userManageFilters: This setting allows a user to create and edit statuses and resources without granting them full admin rights. If this parameter is not included, the default value is "false" . Set it to "true" to enable this permission for the user.
  • userReadOnly: This parameter overrides any calendar-specific settings, making all DayBack calendars read-only for the user. If not included, the default value is "false" . Set it to "true" if you want the user to have read-only access across DayBack. Keep in mind that DayBack respects your FileMaker privilege sets, so even if this value is "false" , users cannot edit records that their FileMaker permissions do not allow.
  • userAllowSharing: While DayBack's interface allows admins to set sharing permissions for nobody, everyone, or just admins, this parameter gives you more granular control by granting sharing access to specific users. If this parameter is not included, the default value is "false" . Set it to "true" if you want the user to have sharing privileges, regardless of the app-wide settings.

Important Note

These parameters only apply when the user is first created. You cannot change a user’s permissions using these URLs after the account has been created. Any changes to a user’s permissions must be made by a DayBack admin through the settings, where the user record can be edited.