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'd 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 (this group token doesn't increase the number of users you're paying for on your license--you probably wouldn't want to do that automatically--but it does allocate those license to new users as they open DayBack).

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 uses will be created a 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 straight forward, but please backup your FileMaker file(s) before continuing. That's what the pros do.

To get started, sign into DayBack as an admin of the group you'll be setting up. If you're 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 4 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=<UserEmail>&userFirstName=<FirstName>&userLastName=<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. 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=“ & $$UserEmail & “&userFirstName=“ & $$UserFirstName & “&userLastName=“ & $$UserLastName

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. 

Still need help? Message Us Message Us