ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / Managing the OAuth 2.0 protocol
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
WLanguage procedure (also called "Callback") called during authentication. This type of procedure can be called:
This procedure can be a local, global or internal procedure.
Example
// Exemple permettant de récupérer un token pour effectuer une requête sur 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"

// Demande d'authentification : ouvre la fenêtre de login
AuthIdentify(OAuth2Params, AuthIdentifie_Callback)

	INTERNAL PROCEDURE AuthIdentifie_Callback(bRésultat is boolean, MonToken is AuthToken)
		IF bRésultat = True THEN
			// Requête authentifiée sur une API de Dropbox
			req is httpRequest
			req.Method = httpPost
			req.URL = "https://api.dropboxapi.com/2/files/list_folder"
			req.AuthToken = MonToken // Token d'authentification
			req.ContentType = "application/json"
			vParamAPI is Variant
			vParamAPI.path = "/Homework/math"
			vParamAPI.recursive = False
			vParamAPI.include_media_info = False
			vParamAPI.include_deleted = False
			vParamAPI.include_has_explicit_shared_members = False
			req.Content = VariantToJSON(vParamAPI)

			réponseHTTP is httpResponse = HTTPSend(req)
			let Données = JSONToVariant(réponseHTTP.Content)
			// Utilisation des données reçues ...
		END
	END
Syntax
Callback_Authentication(<Success> , <Token>)
<Success>: Boolean
  • True if authentication has been completed,
  • False otherwise.
<Token>: AuthToken variable
AuthToken variable corresponding to the token containing the access information for the next requests that require authentication.
Business / UI classification: Neutral code
Component: wd300ggl.dll
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 04/02/2025

Send a report | Local help