Skip to content

4D-Open-Source/Google-Authenticator-4D

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Authenticator 4D

A 4D implementation of Google Authenticator. This can be compiled into a component or simply incorporated into your v18+ code to allow you to use the Google Authenticator.

Limitations

This implimentation uses an online service to produce the QR code. This presents a vulnerability in that the QR code could be saved by authenticatorapi.com though they wouldn't know what it's for.

Setting up

This is called pairing and you use the Pair method. It is required one time but may be called more, for example if a user gets a new phone. The user simply needs to download the app to their phone, open it and click the add button.

You pass an object to the Pair method containig 3 values:

  • your application name
  • the user name
  • a secret specific to the user. A UUID is a good candidate but any string will do.

For example:

$params:=New object
$params.appName:="MyApp Name"
$params.appInfo:="user name"
$params.appSecret:="thx1138"  //  this should be unique to each user - like their PK UUID

Pair ($params)

Pair dlog

That's it. The user is set up and there is nothing you need to store.

Validating

After the user enters their password call the Validate method. In this case you pass an object with the secret for this user. The user has 4 chances to enter the correct authentication code before the method fails.

Validate dlog

Example code for this:

If (Validate (New object("appSecret";"thx1138")))
	ALERT("User Validates!")
Else 
	ALERT("User not validated.")
End if 

About

A 4D implementation of Google Authenticator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published