Last active
October 8, 2018 02:35
-
-
Save juucustodio/6328883835b3a971ccf41b5828f1f1ee to your computer and use it in GitHub Desktop.
Example how to implement a token generator in Xamarin.Forms Applications. - http://julianocustodio.com/token
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Callback(object state) | |
{ | |
totp = new Totp(secretKey); | |
Codigo = totp.ComputeTotp(); | |
var remainingTime = totp.RemainingSeconds(); | |
Segundos = $"00:{remainingTime:00}"; | |
} | |
protected override void OnAppearing() | |
{ | |
base.OnAppearing(); | |
timer = new Timer(Callback, null, 0, 1000); | |
} | |
protected override void OnDisappearing() | |
{ | |
timer.Dispose(); | |
base.OnDisappearing(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment