Sign in Join

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

Mailing lists / fpc-pascal / 2026-10

FPC's google API units: heads up...

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hi,

For those using the google APIs part of FPC:

I have removed all pre-generated API units from the FPC repo. Only a discovery2pas tool remains, plus some demos.

Rationale:

The old tool used to generate the units was not complete, and the resulting units sometimes needed hand tweaking, requiring me to commit them.

Since some time we have json-schema and openapi support, with better code generators. So I switched the code tool to use the json-schema and openapi support.

The result is that you can now generate the units directly from the google API schema and be sure they compile and function correctly.

This removes the need for committing the results (reducing FPC's compile time as a side effect :))

There are 3 examples for the APIs, with instructions on how to use them.

The tool will generate a compatibility unit (-b) if you want it, but I strongly suggest you simply convert your code to use the new objects. The properties names and types will be the same for 99% of cases.

Google meanwhile has removed the support for the OOB OAuth flow which the old code used, so I adapted the examples to use a small in-process HTTP server to capture the access & refresh tokens. This small server is available in the package as well.

Michael.

Wayne Sherman
to Michael Van Canneyt
Michael Van Canneyt wrote
For those using the google APIs part of FPC:

Thank you for your continued work on Google API support in FPC. (as well as all of your other work on FPC)
Consider adding service account support to Google Client.

User OAuth - Web apps, mobile apps, desktop software, or CLI tools where users log in to grant the app access. Choose User OAuth when building a customer-facing product (e.g., "Sign in with Google", an app that syncs a user's Google Calendar, or a tool that uploads files directly to a user's personal Drive).

Service Accounts - Backend services, cron jobs, CI/CD pipelines, microservices, and server-side automation. Choose a Service Account when building automated backend pipelines, server-side background processes, or cloud workloads that manage infrastructure or shared company resources. Service Accounts still use OAuth 2.0: Under the hood, a service account signs a JSON Web Token (JWT) using its private key and exchanges it for a short-lived OAuth 2.0 access token. The distinction is that this process is automated and does not require a human user to consent.

Wayne Sherman
to Wayne Sherman
Consider adding service account support to Google Client.

Attached is a suggested architecture from ChatGPT 6 Astra (incorporating Gemini suggestions).

Wayne Sherman
to Wayne Sherman
Attached is a suggested architecture from ChatGPT 6 Astra (incorporating Gemini suggestions).

In case the PDF didn't make it through the list here are links to the same: Google_API_Client_Proposed_Authentication_Design.pdf https://drive.google.com/file/d/10058rqdTXn_Eja6W8FuZIkuNqWm16Qtr/view?usp=drive_link

Google_API_Client_Proposed_Authentication_Design.docx https://docs.google.com/document/d/1OczlHoXcHTKn9wXoxw3bIOJ1H_DYjtg-/edit?usp=drive_link&ouid=114783738430308530450&rtpof=true&sd=true

Michael Van Canneyt
to Wayne Sherman: Thank you for your continued work on Google API support in FPC. (as well as all of your…
Wayne Sherman wrote 22 lines
Michael Van Canneyt wrote: > For those using the google APIs part of FPC: Thank you for your continued work on Google API support in FPC. (as well as all of your other work on FPC) Consider adding service account support to Google Client. User OAuth - Web apps, mobile apps, desktop software, or CLI tools where users log in to grant the app access. Choose User OAuth when building a customer-facing product (e.g., "Sign in with Google", an app that syncs a user's Google Calendar, or a tool that uploads files directly to a user's personal Drive). Service Accounts - Backend services, cron jobs, CI/CD pipelines, microservices, and server-side automation. Choose a Service Account when building automated backend pipelines, server-side background processes, or cloud workloads that manage infrastructure or shared company resources. Service Accounts still use OAuth 2.0: Under the hood, a service account signs a JSON Web Token (JWT) using its private key and exchanges it for a short-lived OAuth 2.0 access token. The distinction is that this process is automated and does not require a human user to consent.

It is on my todo list, I didn't get around to that (I only managed to commit now, the work dates from almost 10 months ago :/).

I'll study your design, thank you.

Michael.