OAuth2FM – Manage Google OAuth2 Accounts And Tokens

by Jim Randell


A Simple Dashboard And A Single Script Provide FileMaker Developers With A Powerful Tool To Handle The Heavy Lifting in Google’s OAuth2!

…No Plugins, No Custom Functions, Just FileMaker

  • Create and Manage multiple Google OAuth2 Account Profiles, each with multiple variations of privileges for that Account
  • Present your users with Google’s Login Page, followed by Google’s Page prompting a user to ‘Allow Access To Your Google Account Data’
  • Ready to use as a separate file with your solution – Simply Call 1 Script
  • Incorporate into your own solution – using 2 Layouts, 1 Table, and 1 Script (with 2 subscripts)
  • Optional Value Lists (and one table for Value List reference) are not required, but streamline Profile creation on the dashboard




Lots Of Help:

The HELP Buttons provide step by step instructions with annotated screen shots, so that creating a Google Developers Account, and obtaining your authentication Tokens, is as easy as Pi to the 2nd power!



Coding Philosophy:

The Scripts and Calculations in this solution, as with everything I do in FileMaker, are written for the next developer.

With that in mind:

  • Calculations are written in the vernacular taught to my by my 5th grade algebra teacher: SHOW YOUR WORK.
    • To that end, I make extensive use of the LET Statement, to show you, the reader, the logical progression of the values as they are manipulated and evolve.
    • …sometimes at the expense of brevity, but always to the benefit of clarity and safety, as well as for the consideration of those without access the FileMakerPro Advanced.
  • Global Variables and Internal SQL Calls are strictly avoided (and not used at all in this Module).
    • They are powerful tools, but they add complications to Interconnecting Modules and hinder portability.
  • Scripted Finds are written out long (Enter Find Mode, Set Field, Perform Find).
    • (With few exceptions) this makes scripts easier to read and comprehend by other developers.
  • Scripts Are Well Documented, forming an overall, step by step narrative.
    • Liberal use of white space is made, separating the code into ‘easily digestible’ chunks.




A second set of scripts using Custom Functions, and accepting all the required values passed as Parameters, has been pushed back for the next release, pending feedback received by this initial release.



3 responses to “OAuth2FM – Manage Google OAuth2 Accounts And Tokens”

  1. Signo says:

    The download link is not right, go to https://github.com/jimrandell/OAuth2FM-ForGoogleAPI to download the module.

  2. Jim Randell says:

    Hello Sgno, and the person at mFM who changed my download link (Todd? thanks!). Not sure why its not working for you, but I think I’ll keep using direct link from now on.

    Signo, I’m sure your time is as critical a commodity to you, as mine is to me, and I’m not sure I would have taken the time to search for the module and then write the post as you did.
    Your a good dude (or dudet), and there’s a stranger out there who appreciates that, THANK YOU!

  3. Joe says:

    Hey Jim! This module is fantastic! I’ve been putting it through the wringer for a few weeks now and have one question for you:

    If I setup the file as a TO and create a 1-1 relationship using the constant value, I can call the OAuth2FM_Processor script and set the token as a var using the TO. That part works flawlessly.

    If I want to forego the TO method and use the OAuth2FM file as a strict API (as an external data source only), the script results seem mixed. When the OAuth settings are set to “Force-Reauthentication” or “Force Token Refresh”, I can call the Processor script and it will return a result (with the token data). If the setting is set to “Use Default” and auth code fields are valid, the OAuth2FM_Processor script returns a value of “AllValid”, but without the token data. Could you append the $access_token to that result when the auth code fields are valid? This way, the call to the OAuth2FM_Processor only needs to parse the result for the access token before calling the Google API, without the use of a TO relationship.

    Thanks again!
    – joe –

Leave a Reply

Your email address will not be published. Required fields are marked *