title: How do I generate a unique token (for e-mail verification)?
body: <p>I want to implement a system that after user signs up, user will receive an email includes a link to verify this email is for that user.</p>
  
  <p>The way I generate the token for verifying the email is like this:</p>
  
  <pre><code>import (
      "crypto/rand"
      "encoding/base64"
  )
  
  func generateToken() (string, error) {
      b := make([]byte, 35)
      _, err := rand.Read(b)
      if err != nil {
          return "", err
      }
      return base64.URLEncoding.EncodeToString(b), nil
  }
  </code></pre>
  
  <p>But what I want to ask is if this method is OK? How to make all the token generated by this method is unique ? </p>
  
  <p>What is the normal way to implement this system ?</p>
  
  <p>Please give me some ideas and tell me if this method of generating token is good.</p>
  
  <p>Thanks.</p>