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

Your Name:
Your Email:
 
SUBSCRIBE
 
Previous Newsletters
 




Products Articles Downloads Order Support
Customer Portal      

OAuth

Features | Detailed Description

The OAuth is a component from the Clever Internet Suite library.

The OAuth component is used to authorize a client and provide an authorization string used in future requests.

Available in VCL edition.

Features:

  • Can be used in Desktop applications and Web applications
  • Accept redirection from an OAuth server page
  • Enter an authorization code directly in a form
  • Can work with any Web service that supports OAUTH 2.0
  • Free one year upgrades and support

Desktop applications

The OAuth component allows opening an external web browser and authorize at OAuth server. After authorizing The component starts an embedded web server that accepts the redirection from an OAuth server page after completing the authorization process. The authorization code is automatically extracted from the redirection URL and used for exchanging for an access token.

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

clOAuth1.AuthURL := 'https://accounts.google.com/o/oauth2/auth';
clOAuth1.TokenURL := 'https://accounts.google.com/o/oauth2/token';
clOAuth1.RedirectURL := 'http://localhost';
clOAuth1.ClientID := '421475.......';
clOAuth1.ClientSecret := '_4HJyA.......';
clOAuth1.Scope := 'https://mail.google.com/';

clSmtp1.Server := 'smtp.gmail.com';
clSmtp1.Port := 587;
clSmtp1.UseTLS := ctExplicit;
clSmtp1.UserName := 'user @ gmail.com';

clSmtp1.Authorization := clOAuth1.GetAuthorization();

clSmtp1.Open();
......

Web applications

This authorization is used by web applications and allows implementing the OAuth authorization in a website.

// [Delphi]
clOAuth1.AuthorizationFlow := afAuthCodeFlow;
clOAuth1.AuthorizationEndPoint := apWebApplication;

oauth.AuthURL := 'https://oauth.yandex.ru/authorize';
oauth.TokenURL := 'https://oauth.yandex.ru/token';
oauth.RedirectURL := 'https://oauth.yandex.ru/verification_code?ncrnd=119';
oauth.ClientID := '1990c2cdd.....';
oauth.ClientSecret := '4888dfbd3840......';
oauth.Scope := 'access_yandex_disk';

auth_url := oauth.GetAuthorizationUrl();
//use the auth_url in your Web application for authorizing the Web session.

........

auth_string := oauth.GetAuthorization(request_uri);
//use this method for obtaining the required authorization string
//the request_uri is the redirect URL from an authorization service

Samples, including WinForm clients with full source code

Please see the Demos code (GMailSMTP, GMailIMAP) and also the indexed Help documentation provided with the Clever Internet Suite installation to learn more about using this component in your application.

Includes support for Delphi, C++Builder.

Complete Delphi source code

When Purchasing the Clever Internet Suite you receive the full sources for all suite components and also free unlimited support.

Interested?

    Copyright © 2000-2024