Delphi Google Sign-In Login

From sgcWebSockets 2022.5.0 there is a new class that simplifies the process of authenticate an user using the Google Account as Authentication. The class let you login with your Google Account in an easy way.


The module requires first configure your OAuth2 Application in your Google Account, once are configure just add a couple of lines in your application to allow users login with any Google Account.

The Local Server used to read the response from Google, by default listens on IP Address and port 8080. So you must configure the CallBack URL in the Google Application. Of course, you can modify the IP Address and port.

Once configured the OAuth2 Application in the Google Account, just create an instance of TsgcHTTP_OAuth2_Client_Google and call the method Authenticate passing as parameters the Client_Id and Client_Secret. This method waits (by default up to 60 seconds) till the user has login successfully. Returns an object where you can check if the user has authenticated or not, the Name, Id... and more data from the user profile.

Delphi Login Google 

procedure GoogleSignIn;
  oClient: TsgcHTTP_OAuth2_Client_Google;
  oData: TsgcOAuth2_Google_Data;
  oClient := TsgcHTTP_OAuth2_Client_Google.Create(nil);
    oData := oClient.Authenticate('client_id', 'client_secret');
    if oData.Authenticated then
Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

Delphi Microsoft Sign-In Login
Delphi Microsoft Azure SDK

Related Posts