Go Gin Middleware Email Verification Guide
Add real-time email verification and disposable-email blocking to Go Gin Middleware with the VeriShield Edge API. The snippet below gates a signup and returns the canonical email identity.
Language
Go 1.22
Ecosystem
Gin / net-http
Latency
< 85ms
Install
Shell
go get github.com/gin-gonic/ginVerification code
Go 1.22
func VeriShieldGuard() gin.HandlerFunc {
return func(c *gin.Context) {
var body struct{ Email string `json:"email"` }
if err := c.ShouldBindJSON(&body); err != nil {
c.AbortWithStatus(400); return
}
payload, _ := json.Marshal(map[string]string{"email": body.Email})
req, _ := http.NewRequest("POST", "https://verishield-edge-api.p.rapidapi.com/v1/verify", bytes.NewReader(payload))
req.Header.Set("X-RapidAPI-Key", os.Getenv("RAPIDAPI_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil { c.AbortWithStatus(502); return }
defer resp.Body.Close()
var report map[string]any
json.NewDecoder(resp.Body).Decode(&report)
risk := report["fraud_risk"].(map[string]any)
if risk["recommendation"] == "BLOCK" { c.AbortWithStatus(403); return }
c.Next()
}
}What this protects against
Disposable and temporary inboxes, Gmail dot-trick and plus-alias multi-accounting, high-entropy bot usernames, and freshly registered fraud domains. The API returns a 0-100 fraud score with an ALLOW, CHALLENGE_2FA or BLOCK recommendation.