Hi guys,
Any code snippet to get OAuth2.0 token without using ActiveX?
TIA
// Create the XMLHTTP object
oHTTP := CreateObject("MSXML2.XMLHTTP")
// Specify the URL to send the request to
cUrl := "https://example.com/oauth/token"
// Specify the POST data
cPostData := "grant_type=client_credentials&client_id=your_client_id&client_secret=your_client_secret"
// Set up the request
oHTTP:Open("POST", cUrl, .T.)
oHTTP:SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
// Send the request
oHTTP:Send(cPostData)
// Check if the request was successful
IF oHTTP:Status = 200
cResponse := oHTTP:ResponseText
? "Access Token:", cResponse
ELSE
? "Failed to retrieve access token. Status code:", oHTTP:Status
ENDIF
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 79 guests