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
- Host: GitHub
- URL: https://github.com/maurodelazeri/google-authenticator
- Owner: maurodelazeri
- Created: 2018-11-29T13:35:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-29T13:47:18.000Z (over 7 years ago)
- Last Synced: 2025-02-23T18:15:29.414Z (over 1 year ago)
- Topics: auth, golang, google-authenticator, opt
- Language: Go
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```