Site Map Contact Us Home
E-mail Newsletter
Subscribe to get informed about
Clever Components news.

Your Name:
Your Email:
Previous Newsletters

Products Articles Downloads Order Support
Customer Portal      

OAUTH and cloud services (Yandex Disk)


This article demonstrates how to use the Clever Internet Suite components for implementing the OAUTH authorization and accessing cloud services, such as Yandex.Disk.

The Clever Internet Suite provides a special OAuth component that initiates the OAUTH 2.0 authorization process and obtains the authorization token. This token can be used by any component (not only Clever Internet Suite) for authorizing at online service.

// [Delphi]
clOAuth1.AuthorizationFlow := afAuthCodeFlow;
clOAuth1.AuthorizationEndPoint := apLocalWebServer;
clOAuth1.EscapeRedirectURL := False;

clOAuth1.AuthURL := '';
clOAuth1.TokenURL := '';
clOAuth1.RedirectURL := 'http://localhost';
clOAuth1.LocalWebServerPort := 55896;
clOAuth1.ClientID := '1335c5e0cf6d4c2f96661d5d76a86117';
clOAuth1.ClientSecret := '5e0689f4ce86415c856f113fa75eb98b';
clOAuth1.Scope := 'unit_test';

clWebDav1.Authorization := clOAuth1.GetAuthorization();

Yandex.Disk provides WebDAV interface for accessing its cloud service. Let's use the WebDAV component that fully supports OAUTH.

// [Delphi]
clWebDav1.CharSet := 'UTF-8';
clWebDav1.Depth := wdResourceAndChildren;
clWebDav1.SilentHTTP := True;
clWebDav1.Expect100Continue := True;
clWebDav1.TLSFlags := [tfUseTLS, tfUseTLS11];

clWebDav1.GetProperties('', ['displayname']);

for i := 0 to clWebDav1.ResourceProperties.Count - 1 do

   uri := clWebDav1.ResourceProperties[i].Uri;
   if (Pos('http', LowerCase(uri)) <> 1) then
      uri := TclUrlParser.CombineUrl(uri, '');


The complete source code for the samples from this article can be downloaded on GitHub

Download free trial of Clever Internet Suite: Download

Learn more about OAuth and WebDAV components: Clever Internet Sute

Ask questions: Customer Portal

Kind regards
Sergey Shirokov
Clever Components team

    Copyright © 2000-2024