TURL_AuthorizeWithCallbackScript (function reference)

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

switchesdetermines the behaviour of the function
methodeither POST or GET
requestTokenURLURL to obtain a request token from the web service
authorizationURLbeginfirst part of the authorization URL, which will be used to construct the complete URL
accessTokenStepURLURL to obtain the (final) access token and access token secret.
fileNamethe name of the file which contains the script to trigger
scriptNamethe name of the script to trigger. The script parameter will contain the access token

Switches

switches must be set to:

-OAuthProtocolthe 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 14 to 17

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 14 to 17 –> TURL_AuthorizeWithCallbackScript (urlp4422) 2019-0321 09:40:35