Get Access Token with Filemaker

  • 1
  • Idea
  • Updated 6 months ago

-In Filemaker use the  "Insert from URL" scrip step with the following prameters:


Specify URL: "

Check "Automatically encode URL" I don't know why.


Target: $yourTokenHoldingVariable

Success means that this variable will populated by by the API with a JSON object containing Access and Refresh tokens.. both of which are subjects for a different day.


cURL Options: <--------where the magic happens and where I died many times on the hill of disappointment


Here is what you are trying to create (less the carriage returns I added here fror easy reading):


-X POST ""

-H "Accept: application/json"

-H "Content-Type: application/x-www-form-urlencoded"

-H "Authorization: Basic  [Base64Encoded<appKeyorID>:<appSecret>]"

-d "username=<username>&password=<password>&extension=<extension>&grant_type=password"

-D $dump



Here is the code (again with some returns for easy reading):


"-X POST" &

" -H \"Accept: application/json\"" &

" -H \"Content-Type: application/x-www-form-urlencoded\"" &

" -H \"Authorization: Basic "& Base64EncodeRFC (4648;API::Client ID &":"& API::secret ) & "\"" &

" -d grant_type=password&username=*********&extension=101&password=************" &

" -D $dump"



Here are results from the calculation engine with some carriage returns here for ease of reading:



-H "Accept: application/json"

-H "Content-Type: application/x-www-form-urlencoded"

-H "Authorization: Basic EkjfiKkfjikjcksidfjskeiowcolonappfsdfdfKFAKETRUNCIATEDFORTHISPOST=="

-d grant_type=password&username=15834234193&extension=101&password=notReallyMyPassword

-D $dump



Further breakdown... someone who *actually* knows what they are doing: Chime in!





We are posting here... let the API know.



-H "Accept: application/json"


Header telling the api we are expecting (Accepting?) JSON in return.



-H "Content-Type: application/x-www-form-urlencoded"


Uh... some HTTP / cURL stuff.  I think this is telling the API that we are passing data in a URLencoded form.



-H "Authorization: Basic EkjfiKkfjikjcksidfjskeiowcolonappfsdfdfKFAKETRUNCIATEDFORTHISPOST=="


"Basic" "Authorization" Header. Here we are Authorizing or Authenticating our APPLICATION. To build that big random looking string of characters: You need to Base64Encode, the concatenation of, your Application Key (also called your ClientID), a : (colon), AND your Application Secret. Read the previous sentence again... slowly. 


If you store your Key and Secret in fields this function should work: 


Base64EncodeRFC (4648;API::AppKeyOrClient ID &":"& API::secret )





-d grant_type=password&username=1585643673&extension=101&password=NotReallyMyPassword


Here we are Authenticating the USER of the Application.  The user name is the users phone number or email address. 


-d means "here is a payload of data"



-D $ourDumpVariable


This is not required by the API but is helpful to us for troubleshooting. -D in cURL means "dump" (send back to us?) the entire response... success or failure.  and $ourDumpVariable is a filemaker variable conjured by the cURL options of this Insert from URL script step.  This is a critical tool for figuring out WTF when wrong.
Photo of Function:GetTrucks


  • 30 Points

Posted 6 months ago

  • 1
Photo of Tyler Long

Tyler Long, Official Rep

  • 9,828 Points 5k badge 2x thumb
What can I help? You post lots of notes but I don't see your question.

If you want to do it using curl, here is an article:
Photo of Function:GetTrucks


  • 30 Points
It's really a tutorial for others using Filemaker which supports a limited set of cURL functions.  I've looked through these community pages and found no significant guidance for Filemaker users... so I thought I'd post my solution.... there is an error in posting that I'd like to edit out but I don't seem to have the rights to do that....  



should be just:


The URL is specified in another part of the Filemaker  "Insert from URL"  scrip step dialog...  NOT the "specify cURL options" sections.