code: func (m *AuthMethod) logoutHandler(ctx *router.Context) {
  	c, rw, r := ctx.Context, ctx.Writer, ctx.Request
  
  	dest, err := normalizeURL(r.URL.Query().Get("r"))
  	if err != nil {
  		replyError(c, rw, err, "Bad redirect URI (%q) - %s", dest, err)
  		return
  	}
  
  	// Close a session if there's one.
  	sid, err := decodeSessionCookie(c, r)
  	if err != nil {
  		replyError(c, rw, err, "Error when decoding session cookie - %s", err)
  		return
  	}
  	if sid != "" {
  		(logging.Fields{"sid": sid}).Infof(c, "Closing the session")
  		if err = m.SessionStore.CloseSession(c, sid); err != nil {
  			replyError(c, rw, err, "Error when closing the session - %s", err)
  			return
  		}
  	}
  
  	// Nuke all session cookies to get to a completely clean state.
  	removeCookie(rw, r, sessionCookieName)
  	m.removeIncompatibleCookies(rw, r)
  
  	// Redirect to the final destination.
  	logging.Infof(c, "Redirecting to %s", dest)
  	http.Redirect(rw, r, dest, http.StatusFound)
  }
docs: // logoutHandler nukes active session and redirect back to destination URL.