mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-11 10:34:27 +00:00
961 B
Executable File
961 B
Executable File
Otp
An m3o.com API. For example usage see m3o.com/otp/api.
Endpoints:
Validate
Validate the OTP code
https://m3o.com/otp/api#Validate
package example
import(
"fmt"
"os"
"go.m3o.com/otp"
)
// Validate the OTP code
func ValidateOtp() {
otpService := otp.NewOtpService(os.Getenv("M3O_API_TOKEN"))
rsp, err := otpService.Validate(&otp.ValidateRequest{
Code: "656211",
Id: "asim@example.com",
})
fmt.Println(rsp, err)
}
Generate
Generate an OTP (one time pass) code
https://m3o.com/otp/api#Generate
package example
import(
"fmt"
"os"
"go.m3o.com/otp"
)
// Generate an OTP (one time pass) code
func GenerateOtp() {
otpService := otp.NewOtpService(os.Getenv("M3O_API_TOKEN"))
rsp, err := otpService.Generate(&otp.GenerateRequest{
Id: "asim@example.com",
})
fmt.Println(rsp, err)
}