Skip to main content

TURL_AuthorizeWithCallbackScript (function reference)

By October 1, 2021October 13th, 2021Online Help, Troi URL plug-in
Troi URL Plug-in > Functions reference > TURL_AuthorizeWithCallbackScript
Troi URL Plug-in for FileMaker Pro

TURL_AuthorizeWithCallbackScript

Talks with a web service to get an authorization URL. With the returned URL the user can authorize the plug-in (in a web browser) to use this service.

SyntaxFunction badge

TURL_AuthorizeWithCallbackScript( switches ; method ; requestTokenURL ;
                                  authorizationURLbegin ;
                                  accessTokenStepURL ; fileName ; scriptName )

Parameters

switches determines the behaviour of the function
method either POST or GET
requestTokenURL URL to obtain a request token from the web service
authorizationURLbegin first part of the authorization URL, which will be used to construct the complete URL
accessTokenStepURL URL to obtain the (final) access token and access token secret.
fileName the name of the file which contains the script to trigger
scriptName the name of the script to trigger. The script parameter will contain the access token

Switches

switches must be set to:

-OAuthProtocol the plug-in is using the OAuth protocol (version 1.0A)

Returned Result

Data type returned

text

Result

If successful this function returns the complete authorization URL. With this URL the user can authorize the plug-in to use this service.

If unsuccessful it returns an error code starting with $$ followed by the error code.

Originated in

Troi URL Plug-in 6.0

Compatibility

FileMaker Pro 16 to 19

Considerations

This function provides the first step to authorize the plug-in. When the user gives autorization a script is triggered, which can finalize the authorization.
The plug-in currently only supports the OAuth 1.0A Authorization protocol.

Example

Set Variable [ $Twitter_Request_token_step_URL ; "https://api.twitter.com/oauth/request_token" ]
Set Variable [ $Twitter_Authorization_URL_Begin ; "https://api.twitter.com/oauth/authorize" ]
Set Variable [ $Twitter_Access_token_step_URL; "https://api.twitter.com/oauth/access_token" ]

#Specify the file name and script name to be triggered
Set Variable [ $FileName;  Get(FileName) ]
Set Variable [ $ScriptName; "OAuth_TriggerScript" ]

# Get the URL to the authorization web page where the user can grant access to Troi URL Plug-in:
Set Variable [ $Twitter_Authorization_URL ;  
        TURL_AuthorizeWithCallbackScript( "-OAuthProtocol" ; "POST" ; 
        $Twitter_Request_token_step_URL ;
        $Twitter_Authorization_URL_Begin ;
        $Twitter_Access_token_step_URL ;
        $FileName ; $ScriptName ) ]
Open URL [ $Twitter_Authorization_URL ]

When the user gives autorization the script “OAuth_TriggerScript” in the current FileMaker file is triggered, which can then store the credentials. See our Twitter.fmp12 example file for more details.

Related functionsFunction badge

TURL_GetAuthorizationURL
TURL_SendAuthorizedRequest

Related topics

Troi URL Plug-in online help (overview)


Online Help Page for Troi URL Plug-in for 16 to 19 –> TURL_AuthorizeWithCallbackScript (urlp4422) 2021-1013 16:24:50