In fmOAuth (0.0.2), OAuth authentication (Google) implements a function that can use arbitrary applications

Hello.
I am Teruhiro Komaki of frudens Inc.

Although it may be a bit hard to understand from the title, it is implemented so that you can replace the consent screen with any application, not fmOAuth(default).

That way, you can login to the console with your Google account, have the application created, and pass the arguments.

How to write your own app, write another article.

Consent screen of fmOAuth

The default agreement screen is as follows.

fmoauth-002-google-oauth-application1

Consent screen of arbitrary application

When creating an application on the console (GCP) and passing the information of the application as a script argument, the following agreement screen will be displayed.

fmoauth-002-google-oauth-application2

Script

fmoauth-002-google-oauth-application3

Script (code)

# 
# ──────────────────── Parameter
# 
# case fmOAuth
# 
If [ True // fmOAuth ] 
	Insert Text [ Select ; $scopeList ; 「https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/drive https://mail.google.com/」 ] 
	Set Variable [ $param ; Value: JSONSetElement (  "{}" ;  [ "scopeList" ; $scopeList ; JSONString ] ) ] 
End If
# 
# case Your Google App
# 
If [ False // Set CustomFunction from Your Google App Information ] 
	Set Variable [ $appId ; Value: z_yourGoogleAppId ] 
	Set Variable [ $secret ; Value: z_yourGoogleAppSecret ] 
	Set Variable [ $redirect ; Value: z_yourGoogleAppRedirect ] 
	Insert Text [ Select ; $scopeList ; 「https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/drive https://mail.google.com/」 ] 
	Set Variable [ $param ; Value: JSONSetElement (  "{}" ;  [ "appId" ; $appId ; JSONString ] ;  [ "secret" ; $secret ; JSONString ] ;  [ "redirect" ; $redirect ; JSONString ] ;  [ "scopeList" ; $scopeList ; JSONString ] ) ] 
End If
# 
# ──────────────────── Perform Script
# 
Perform Script [ 「0307.Get Refresh Token Google ( appId ; secret ; redirect ; scopeList )」 , File: 「fmoauth」 ; Parameter: $param ]
# 
# ──────────────────── Response Data
# 
If [ IsEmpty ( FilterValues ( JSONListKeys ( Get ( ScriptResult ) ; "" ) ; "refresh_token" ) ) ] 
	# error
	Set Field [ USER::googleRefreshToken ; Get ( ScriptResult ) ] 
Else
	# ok
	Set Field [ USER::googleRefreshToken ; JSONGetElement ( Get ( ScriptResult ) ; "refresh_token" ) ] 
End If
# 

I am a Japanese developer. (I am studying English.) I met the FileMaker Platform at the company I worked at the time. Develop a custom App as an in-house developer. Acting as freelance from 2014 and establishing frudens Inc. in 2016. Recently, I use 'Insert From URL'. I enjoy FileMaker and various services in Integration!

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.