Directly login WebDirect file with user and password in FileMaker 16!

 width=In pre FM16 versions we were limited to a HTTP GET request to open a WebDirect file with a url. This would just open the file with the default login credentials or, if no default credentials specified in the file options, it would bring us to the login page of FileMaker WebDirect. This limited us in opening a file with specific credentials or parameters.

Not anymore! Since FM16 we are able to specify parameters when we open a FileMaker WebDirect file with a HTTP POST request. Two of these parameters are account name & password . But also a script, scriptparameter, variables and a home-url can be passed as parameters.

This gives us, the FileMaker Developer, the ability to fully make or own login page or to integrate easier with other systems.

Be cautious! 

The account name and password are sent over the wire! So you will definitely need an SSL connection from your startpage to your FileMaker file. Also be cautious with any hard coded account names and passwords in your code! This is definitely not a best practice.

Gotchas

When a wrong account name / password given: you get an error message from FileMaker WebDirect. When a home-url specified: you are directly directed to the home-url page after the refused login attempt.

The ‘fmurlscript’ extended privilege set must be enabled if you want to launch a script from the POST request. It is by default disabled for new privilege sets.

Demo

Click the link below to download the example file.
It has a sample of HTML code to test the HTTP POST request.
The only thing you need to do is fill in the url to your file.
(something like: https://myserver.com/fmi/webd/filename )
Specify your account name and password and you’re set.

WD_HTTPPOST_download.fmp12

Interesting Links

https://fmhelp.filemaker.com/docs/16/en/fmwd/#accessing_post
https://fmforums.com/topic/101691-http-post-in-webdirect-16/