FileMaker Admin API Authentication Issue
Now that the FileMaker Admin API is a standard feature in FileMaker Cloud for AWS 1.18 and FileMaker Server 18 and no longer a trial* I’ve been incorporating certain parts of the Admin API into client solutions. For example it is often helpful to see how many users are logged into your solution and get a list of their Account Names without having to use the Admin Console, or provide non admin users with access to the Admin Console.
I recently encountered an issue when calling the List Clients endpoint to see who was currently connected to a particular FileMaker solution. It was generating a 1627 error (Authentication failed) when performing the Insert from URL script step. This was strange as the same script had been working successfully earlier in the day and in previous days. I double checked the credentials for the server that were being used in the API request and they were correct, and verified these by logging into the Admin Console.
I was a bit puzzled at this stage and ran through the script once more with the Script Debugger. I was saving the response from the Insert from URL script step into a local variable, and upon further examination I noticed this was recording the following response from the Admin API:
{
"response": {},
"messages": [
{
"code": "956",
"text": "Maximum number of Admin API sessions exceeded"
}
]
}
There were no other Admin API sessions in use at this point – the Admin Console wasn’t being used – which further confused things. Logging in to the Admin Console again I could see that the list of connected clients wasn’t correct. If you’ve been using the FileMaker Server Admin Console for a few years now you’re probably familiar with this situation and the need to periodically restart the Admin Server via the following command line interface command:
fmsadmin restart adminserver
Once the Admin Server had restarted I tried the Admin API request to list the currently connected clients and it was successfully this time, so the authentication error was misleading in this case. If you encounter this error and you’ve verified the credentials are correct I would just go and restart the Admin Server on the FileMaker Server using the command line option above.
* the FileMaker Admin API was a trial feature in FileMaker Cloud 1.17 and FileMaker Server 17 and that trial period will expire on September 27, 2019 after which the API will cease to operate
Hi Andrew
Thank you for sharing your experience.
I can confirm this behaviour on FileMaker Server 18.02 as well.
I am quite disappointed that the Admin API is not reliable and does not meet the common requirements.
IMHO, an API should be available and work 100%. We always have to double check to ensure everything works as expected.
Too bad that FileMaker is up until now not able to have a rock solid server available.
But thanks, anyway for sharing your info.
Regards. Martin
I’ve experienced this a few more times since as well. I was surprised that the Admin API could require the adminserver process to be restarted (not sure what happens with FileMaker Cloud vs FileMaker Server). I have to regularly restart the adminserver process as the Admin Console is showing out of date information (incorrect clients etc) – disappointed that the Admin API is also affected by this.
I was getting this error too, but then I realized that I was creating new tokens unnecessarily. I am wondering if you were getting this by creating new sessions / tokens instead of reusing the first token you generated?
Perhaps helpful tidbit from the documentation (https://fmhelp.filemaker.com/docs/18/en/admin-api/index.html#authentication-fac-cac1):
“Each time you use the Basic Authentication scheme to get an access token, a new API session is created. To avoid having multiple API sessions, use the same access token with the Bearer Authentication scheme for all API calls.”
Hi Matt – it’s been a while since I last looked into this issue, but from memory I would have been using the same token if it hasn’t expired as I use the same approach for calls to the FileMaker Data API.
Interesting… It may have been a bug that has been fixed? Let’s go with that. 🙂