An open API service indexing awesome lists of open source software.

https://github.com/maurodelazeri/google-authenticator

Generate Google Authentication Codes with golang
https://github.com/maurodelazeri/google-authenticator

auth golang google-authenticator opt

Last synced: 7 days ago
JSON representation

Generate Google Authentication Codes with golang

Awesome Lists containing this project

README

          

# google-authenticator

Generate Google Authentication Codes with golang

```
go get github.com/maurodelazeri/google-authenticator
```

Insert into the `secret` file the secret generated by your counterpart

```go
package main

import (
"io/ioutil"
"log"
"os"

"github.com/maurodelazeri/google-authenticator"
)

func main() {
data, err := ioutil.ReadFile("secret")
if err != nil {
log.Print(err)
os.Exit(1)
}
secret := string(data)
otp := authenticator.GetTOTPToken(secret)
log.Printf(otp)
}
```

```
$ go run main.go
2018/11/29 08:43:50 153071
```