Creating and Signing-In Users Automatically in DayBack For FileMaker

Introduction

Usually, you'd invite users into your DayBack group as you would in any other online application. Your users will get a welcome email containing their username (their email address) and a temporary password they can change when they first log in.

However, if you've tightly integrated DayBack into your FileMaker application, you may not want users to log into DayBack after logging into your app. You've always been able to add a user token into your webviewer to log users on automatically, but that could be tedious as you need to retrieve a user token from DayBack for each user.

With the latest updates to DayBack, you can now specify a group token in your web viewer: this will create new users if they don't exist and log existing users in automatically. User's don't have to log in manually and you don't have to invite each user by hand. As long as you've purchased enough licenses for all the users in your group, you're all set (by itself, this group token doesn't increase the number of users you're paying for on your license--but it does allocate those licenses to new users as they open DayBack).

If you want to automatically increase the number of user licenses you've purchased, turn on 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

We assume that you have some way of uniquely identifying your FileMaker users. Maybe that's a users table, maybe some of your contacts are flagged as "users," or maybe you're just using unique FileMaker accounts for each of your users. That all works. Determine whatever is the unique string that identifies your uses--an email address, a user ID, or an account name--and you'll pass that into DayBack in your web viewer's URL (instructions follow below). Along with this unique string, you'll pass in a token that identifies your DayBack group. With these two facts, DayBack will lookup the unique user in your group each time they open DayBack in your FileMaker app. If DayBack finds your user, the app will consider them logged in (remember, they have to have logged into your app in the first place in order to get to this web viewer). If DayBack can't find a user in your group with this user string, it will create a new user for them providing you have an additional user license available.

Users created this way are real users that act just like you invited them manually, and you'll be able to manage them (and deactivate them) using the group settings here. New users will be created as regular users, not admins, though you can upgrade one or more of them to admins in group settings after they are created.

When a user opens DayBack and signs in with a FileMaker account you will run a script on startup that will find the corresponding user record or FileMaker account and then set the appropriate data from that matching record into some global variables that can be picked up in DayBack. Once you have a script doing that, you can move on to the steps below.

The "UserEmail"

You can use anything you want to uniquely identify your users, but DayBack will expect this in the form of an email address. If it's a real email address, that's fine. If it's an ID or an account name, consider transforming it into a unique email using your company name. So a user ID might look like [email protected], and an account name might look like [email protected]

Setting this up in your file

This is very straightforward, but please backup your FileMaker file(s) before continuing. That's what the pros do.

To get started, sign in to DayBack as an admin of the group you'll be setting up. If you're a developer setting this up on behalf of a client, you'll want to create at least one admin account for that group. It's up to you if you provide your client with that admin account or manage their DayBack account for them. 

Once signed in as an admin, navigate to the settings tab, then “Administrator Settings”. Click on “Me: <account name>” and then copy the “Group Token”. You will need this for later so you can temporarily paste it somewhere safe for later reference. This is the group to which you'll be adding new users automatically, and into which you'll be logging users in.

1. Open that group's DayBack FileMaker file and navigate to the “DayBack” layout. Enter layout mode and edit the web viewer object by double-clicking on it.

2. There are several URL parameters you can add to the web viewer URL. Two of them, userGroupToken and userEmail are required, userFirstName and userLastName are optional but recommended. Locate the line inside the let statement definition that starts with “url = host & baseParameters” and add the following directly after “baseParameters”:

& "&userGroupToken=<TheGroupToken>&userEmail=" & GetAsURLEncoded ( <UserEmail> )  & "&userFirstName=" & GetAsURLEncoded ( <FirstName> ) & "&userLastName=" & GetAsURLEncoded ( <LastName> )

Keep in mind that the data inside the brackets is dynamic. So ideally that data would be replaced with global variables or field references. UserEmail is case-sensitive, so once you create a new account, you need to make sure you don't change the case in the future. In the case of the group token, you'll paste in the string you copied in step one.

A more real-world example might look like this:

&"&userGroupToken=C1L1D1L1A1SAEW3JRSSPTTRMUQUJQTPQMUUUNOC1T1H1CZ1E1z1zS1E1CM1AJ1VSISMY86SJ1N1CNJTRO1CS1A1A1BPV1DPC1B1QGFSJKWMEB78SSFS9SHJ4SSD&userEmail=" & GetAsURLEncoded ( $$UserEmail ) & "&userFirstName=" & GetAsURLEncoded ( $$UserFirstName ) & "&userLastName=" & GetAsURLEncoded ( $$UserLastName )

We're using GetAsURLEncoded around the variables to make sure any special characters are encoded for use in the URL.

3. Click “OK” and then “OK” again. Enter browse mode and save the layout changes. The file is now ready.

That’s it. Now whenever the file is opened it will automatically sign a user in based on that unique email if they already have a DayBack account. If they do not already have an account one will automatically be created for them. 

Additional URL parameters: user permissions

In addition to the userFirstName and userLastName described above, you can pass in a few other parameters to assign the user's permissions inside DayBack. 

userAdmin - makes this user a DayBack Admin. Admins have access to admin settings, can create and delete users, manage billing, etc. If not included, this attribute is "false," so set this to "true" if you want to make the user an admin. 

userManageFIlters - often you want a user to be able to create and edit statuses and resources without being a full-fledged admin; setting this to "true" will accomplish that for the user being created. If not included in the URL, this value will be false.

userReadOnly - overrides any calendar-specific settings to make all DayBack calendars read-only for this user. If not included, this attribute is "false," so set this to "true" if you want the user to be read-only throughout DayBack. Note that DayBack respects your FileMaker privilege sets, so even if this value is left at "false," users won't be able to edit records their FileMaker privileges don't allow.

userAllowSharing - DayBack's interface lets admins scope sharing to nobody, everyone, or just to admins. If you want to get more granular than that, you can use this setting to grant sharing access to specific users. The default is "false" if this parameter is not used in a URL, so set this to "true" if you want the user to share despite what the app-wide settings say.

Note that these parameters are only applicable when the user is first created: you can't change a user's permissions with these URLs. That would need to be done by a DayBack admin logging into settings and editing the user record there.