Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

delphi-google-oauth2

Browser enabled TCustomAuthenticator for Delphi TRestClient

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

delphi-google-oauth2

Browser enabled TCustomAuthenticator for Delphi TRestClient

This unit is inspired on Delphi's OAuth2 code but:

  • Allows authorization via external browser
  • Uses PKCE flow for added security
  • Allows generation of new tokens when they expire (using the refresh token)

Dependencies

  • You will need libeay32.dll and ssleay32.dll in the same folder of your application's .exe file for the Authenticator to work (because PKCE uses SHA256).
  • You will need Indy

Test authenticator using the demo application (Google_Email_Example)

Open the project and fill in your Application's ClientID and ClientSecret on procedure googleAPI_prepare:

pascal
  // Application specific options (created on Google's console)
  DCSOAuth2Authenticator.ClientID              := 'your ClientID goes here';      // ClientID created on console.developers.google.com
  DCSOAuth2Authenticator.ClientSecret          := 'your ClientSecret goes here';  // ClientSecret for the application registered on console.developers.google.com