       :else nil)))
 
 (defn- issuer-verified? [factory-url asr]
-  (when (and (string? factory-url) (map? asr))
+  (when (and (string? factory-url) (map? asr) (string/starts-with? (get asr :id "") factory-url))
     (try
       (let [badge (if (map? (:badge asr)) (:badge asr) (http/json-get (:badge asr)))
             issuer-url (if (map? (:issuer badge)) (get-in badge [:issuer :id]) (:issuer badge))

            (check-badge db-conn factory-url user-badge)
            (jdbc/execute! db-conn ["UPDATE user_badge SET last_checked = UNIX_TIMESTAMP() WHERE id = ?"
                              (:id user-badge)])
            (catch Throwable ex
              (log/error "check-badges failed")
              (log/error (.toString ex)))))

  (:require [clojure.tools.logging :as log]
            [clojure.java.jdbc :as jdbc]
            [clojure.string :as string]
            [clj-time.core :as t]
            [salava.core.util :as u]
            [salava.core.http :as http]))

