![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) X.com Verfiy Credentials (Deprecated OAuth 1.0a Authentication)See more X ExamplesThis is a simple API call to verify that OAuth1.0a authorization is working.Returns an HTTP 200 OK response code and a representation of the requesting user if authentication was successful; returns a 401 status code and an error message if not. Use this method to test if supplied user credentials are valid. X.com historically used OAuth 1.0a for authenticating API requests. However, as of April 2023, Twitter has deprecated OAuth 1.0a and migrated to OAuth 2.0 for most of its API endpoints. This change was part of Twitter's effort to modernize its API and improve security. That said, if you're working with a legacy system or have access to older documentation, you might still encounter references to OAuth 1.0a. This example shows how Chilkat could be used with the older/deprecated Twitter v1.1 API calls. For more information, see https://developer.x.com/en/docs/x-api/v1/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials
Use ChilkatAx-win32.pkg Procedure Test Handle hoHttp Variant vSbResponse Handle hoSbResponse Boolean iSuccess Integer iStatusCode Handle hoJson String sTemp1 Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End // Indicate OAuth1.0a authentication is to be used with HTTP requests. Set ComOAuth1 Of hoHttp To True // Provide OAuth1.0a credentials Set ComOAuthConsumerKey Of hoHttp To "X_API_KEY" Set ComOAuthConsumerSecret Of hoHttp To "X_API_SECRET" Set ComOAuthSigMethod Of hoHttp To "HMAC-SHA1" Set ComOAuthToken Of hoHttp To "X_ACCESS_TOKEN" Set ComOAuthTokenSecret Of hoHttp To "X_TOKEN_SECRET" Set ComOAuthVerifier Of hoHttp To "" Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponse If (Not(IsComObjectCreated(hoSbResponse))) Begin Send CreateComObject of hoSbResponse End Get pvComObject of hoSbResponse to vSbResponse Get ComQuickGetSb Of hoHttp "https://api.twitter.com/1.1/account/verify_credentials.json" vSbResponse To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get ComLastStatus Of hoHttp To iStatusCode If (iStatusCode <> 200) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End // We received a successful JSON response. Get Create (RefClass(cComChilkatJsonObject)) To hoJson If (Not(IsComObjectCreated(hoJson))) Begin Send CreateComObject of hoJson End Get pvComObject of hoSbResponse to vSbResponse Get ComLoadSb Of hoJson vSbResponse To iSuccess Set ComEmitCompact Of hoJson To False Get ComEmit Of hoJson To sTemp1 Showln sTemp1 End_Procedure |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.