WLanguage procedure ("Callback") called by
AuthIdentify during the authentication. This procedure can be a local, global or internal procedure.
// Example used to retrieve a token to perform a request on DropBox
OAuth2Params is OAuth2Parameters
OAuth2Params.ClientID = "01234567890123456789"
OAuth2Params.ClientSecret = "98765432109876543210"
OAuth2Params.AuthURL = "https://www.dropbox.com/oauth2/authorize"
OAuth2Params.TokenURL = "https://api.dropboxapi.com/oauth2/token"
OAuth2Params.AdditionalParameters = "force_reapprove=false"
// Ask for authentication: opens the login window
AuthIdentify(OAuth2Params, AuthIdentify_Callback)
INTERNAL PROCEDURE AuthIdentify_Callback(bResult is boolean, MyToken is AuthToken)
IF bResult = True THEN
// Request authenticated on a DropBox API
req is httpRequest
req.Method = httpPost
req.URL = "https://api.dropboxapi.com/2/files/list_folder"
req.AuthToken = MyToken // Authentication token
req.ContentType = "application/json"
vAPIParam is Variant
vAPIParam.path = "/Homework/math"
vAPIParam.recursive = False
vAPIParam.include_media_info = False
vAPIParam.include_deleted = False
vAPIParam.include_has_explicit_shared_members = False
req.Content = VariantToJSON(vAPIParam)
HTTPresponse is httpResponse = HTTPSend(req)
let Data = JSONToVariant(HTTPresponse.Content)
// Use the incoming data ...
END
Syntax
AuthIdentify_Callback(<Success> , <Token>)
<Success>: Boolean
- True if authentication has been completed,
- False otherwise.
<Token>: AuthToken variable
Name of the AuthToken variable that corresponds to the token which contains the access information for the next authenticated requests.
Business / UI classification: Neutral code