Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any dart library for the Google Authenticator?

I'm looking for a way to implement/connect the Google-Authenticator into Flutter/Dart. The goal is to be able to validate codes generated in the Google-Authenticator app to create a two-step authentication.

Maybe I'm blind, but due to the name, it's really hard to find anything on it (thanks to the word "authenticator"). The best I could find so far was a PHP port: https://packagist.org/packages/sonata-project/google-authenticator

I'm having trouble to even just find an API Documentation on the Authenticator.

Before I start to write my own implementation: Is there any implementation for Dart already? Where can I find the Google-Authenticator documentation?

Edit 1: clarified the part about implementing Google-Authenticator (to verify codes).

like image 286
Katai Avatar asked Nov 02 '25 17:11

Katai


2 Answers

If anyone is looking for a dart library to use the secret key from Google authenticator to generate a matching token, the following library would help.

https://pub.dev/packages/dart_otp

Dependency: dart_otp: ^1.3.0

print(TOTP(secret: "<secret key>").now());
like image 161
Naseem Ahamed Avatar answered Nov 04 '25 10:11

Naseem Ahamed


Hello @Katai I suppose this functionality is a little hard to find due to the terms, but also because it usually gets mixed up / confused with Google's Sign In feature. If what you're looking is a lib for Google's one time password / authenticator I believe this can help: https://pub.dartlang.org/packages/otp

like image 40
Cardo Avatar answered Nov 04 '25 10:11

Cardo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!