OAuth2 Authorization

OAuth 2.0 authorization framework support in sgcWebSockets. Secure delegated access for web, desktop, and mobile applications.

Capabilities

  • Authorization Code, Client Credentials, and Implicit grant types
  • PKCE extension for public clients
  • Token refresh and revocation support
  • Built-in token storage and management
  • Customizable scopes and redirect URIs

Delphi Example

uses
  sgcHTTP_OAuth2_Client;

var
  OAuth: TsgcHTTP_OAuth2_Client;
begin
  OAuth := TsgcHTTP_OAuth2_Client.Create(nil);
  OAuth.OAuth2Options.ClientId := 'your-client-id';
  OAuth.OAuth2Options.ClientSecret := 'your-secret';
  OAuth.OAuth2Options.AuthorizationEndpoint :=
    'https://auth.example.com/authorize';
  OAuth.OAuth2Options.TokenEndpoint :=
    'https://auth.example.com/token';
  OAuth.Start;
end;

A desktop application cannot keep that client secret, which is why the public-client flow replaces it with PKCE. For the whole job, the verifier and challenge, the loopback redirect, the token exchange, refreshing without opening the browser twice and the five things that usually go wrong first, follow the task guide: Sign a user in with OAuth2 and PKCE. It is one of the Delphi use cases.

Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Ready to Implement OAuth2?

Download the free trial and start building in minutes.