/oauth2demo

This project accompanies the webinar https://www.youtube.com/live/wncJvqp0eao?si=Vc58d7-a9w9Bh43u

Primary LanguagePascal

oauth2demo

This project accompanies the webinar https://www.youtube.com/live/wncJvqp0eao?si=Vc58d7-a9w9Bh43u by Ian Barker, the Embarcadero Developer Advocate. It uses RAD Studio with Delphi 12.3 but may well work with earlier versions too.

The slides from the presentation are here: https://github.com/checkdigits/oauth2demo/tree/main/slides

It shows you how to use OAUTH2 to access the GMail API.

This demo only lists your Gmail labels (INBOX, SENT, etc) in the form of a JSON response, if successful.

IMPORTANT

You will need to create a file in the same folder as the project and call it creds.inc. It should contain the following constants (with your own values in, of course!)


const
  cClientID     = 'your client ID goes here';
  cClientSecret = 'your client secret (from Google) goes here';  
  cClientEmail 	= 'your.email@gmail.com';
  

To set up the credentials go to https://console.cloud.google.com/apis/credentials

Dependencies

This project requires OpenSSL. You can find the required files at https://github.com/IndySockets/OpenSSL-Binaries

Kudos/Credits

This project uses U_DCS_OAuth2.pas which is an excellent open source OAUTH unit written by Tiago Nunes Gonçalves (imperyal) and licensed under the Apache license. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

You can find the whole delphi-google-oauth2 project here: https://github.com/imperyal/delphi-google-oauth2

Ian Barker. March 2025.