OAuth2 authorization code into a VCL desktop application

Hello,
How can I get the OAuth2 authorization code into a Delphi 10.3.3 or 10.4.2 VCL desktop application (Exe), instead of getting it in the browser address bar?
Mybe using TEdgeBrowser or indy components ?
Thanks in advance

Usually, there should be a redirect URL that the browser is redirected too after the client authorizes your application. (Note: I believe they often like an actual browser doing the authorization)

In a desktop application this will be something like http://localhost:1234/myURL, maybe http://127.0.0.1:1234/myURL

You make your delphi application have a web server listen on port 1234 (for the above example), and process the result when it arrives.

Geoff has an example.
GitHub - geoffsmith82/GmailAuthSMTP: This project is a very basic demo showing how to authenticate with OAUTH2 and send an email message for gmail, microsoft/office365 as well as hotmail.com/outlook.com/live.com email addresses.

1 Like