Jump to content

Google OAuth2


Recommended Posts

I created a simple unit for google oauth2.

To get QR Code, call 

UniImage1.Url:=GetQRCodeUrl(UniImage1.Width, UniImage1.Height, 'YOURSECRETKEY', 'your email address', 'Your name');

To ValidateOTP :

if Format('%.6d', [CalculateOTP('YOURSECRETKEY')]) = UniEdit1.Text then
begin
  // Valid 
end;

Here some screenshots

image.png.a501061a7cee450e56f72772cac70c8b.png

 

image.png.4027a4e6a0a6b735fb7c49505e0fdcdc.png

 

 

GoogleAuth.pas

  • Like 3
  • Upvote 5
Link to comment
Share on other sites

  • 6 months later...
On 3/28/2019 at 6:39 PM, Hayri ASLAN said:

I created a simple unit for google oauth2.

To get QR Code, call 


UniImage1.Url:=GetQRCodeUrl(UniImage1.Width, UniImage1.Height, 'YOURSECRETKEY', 'your email address', 'Your name');

To ValidateOTP :


if Format('%.6d', [CalculateOTP('YOURSECRETKEY')]) = UniEdit1.Text then
begin
  // Valid 
end;

Here some screenshots

image.png.a501061a7cee450e56f72772cac70c8b.png

 

image.png.4027a4e6a0a6b735fb7c49505e0fdcdc.png

 

 

GoogleAuth.pas

 

 

image.png.7c4517c7bd9418cd7a96529b1de3d722.png

please send source code.... tnx

Link to comment
Share on other sites

On 3/28/2019 at 6:39 PM, Hayri ASLAN said:

I created a simple unit for google oauth2.

To get QR Code, call 


UniImage1.Url:=GetQRCodeUrl(UniImage1.Width, UniImage1.Height, 'YOURSECRETKEY', 'your email address', 'Your name');

To ValidateOTP :


if Format('%.6d', [CalculateOTP('YOURSECRETKEY')]) = UniEdit1.Text then
begin
  // Valid 
end;

Here some screenshots

image.png.a501061a7cee450e56f72772cac70c8b.png

 

image.png.4027a4e6a0a6b735fb7c49505e0fdcdc.png

 

 

GoogleAuth.pas

 

 

please check this  source and refer me to use that ? with hotmail authenticator

Project2.rar

Link to comment
Share on other sites

  • 11 months later...

hello,

for begining, thanks for this sharing.

i think there is an error for the validation

its is not

if Format('%.6d', [CalculateOTP('YOURSECRETKEY')]) = UniEdit1.Text then
begin
  // Valid 
end;

but this :

  if ValidateTOPT('YOURSECRETKEY',StrToIntDef(trim(UniEdit1.Text),-1)) then
  begin
    // Valid
    ShowMessageN('Valid');
  end

 

Link to comment
Share on other sites

  • 3 months later...
  • 2 months later...
On 3/28/2019 at 3:09 PM, Hayri ASLAN said:

I created a simple unit for google oauth2.

To get QR Code, call 


UniImage1.Url:=GetQRCodeUrl(UniImage1.Width, UniImage1.Height, 'YOURSECRETKEY', 'your email address', 'Your name');

To ValidateOTP :


if Format('%.6d', [CalculateOTP('YOURSECRETKEY')]) = UniEdit1.Text then
begin
  // Valid 
end;

Here some screenshots

image.png.a501061a7cee450e56f72772cac70c8b.png

 

image.png.4027a4e6a0a6b735fb7c49505e0fdcdc.png

 

 

GoogleAuth.pasUnavailable

Hello 

Could you please check link for source code? It looks like it's unavailable now

  • Upvote 1
Link to comment
Share on other sites

  • 6 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...