@tagbase-io/verify
v0.4.0
Published
Read a TAGBASE verification result from your own page.
Maintainers
Readme
@tagbase-io/verify
Use TAGBASE Verify on your own website. A customer taps a tag on your product
and lands on your page. verify() finds the verification behind that visit and
reads it.
Start with the documentation. It walks through the domain setup and every field and error your page has to handle, and we keep it current with the service. Below is the short version.
Use it
<script src="https://cdn.jsdelivr.net/npm/@tagbase-io/verify"></script>
<script>
const result = await tagbase.verify({ baseUrl: 'https://verify.brand.com' })
</script>The script tag defines tagbase, holding verify and VerifyError.
baseUrl is a subdomain of your own site that you point at TAGBASE with one DNS
record. Your page and that subdomain share a cookie, so both have to sit on the
same domain.
result.status is pending, valid, valid_with_warnings, or invalid, and
result.messages holds the words to show your customer. The documentation has
the rest of the result and the errors to catch.
Location
The client asks the browser where it is and reports the answer against the
scan. Pass geolocation: false to skip the prompt. A team or product can
require a location instead: the server then holds the result until the browser
shares one, the client asks and sends it on its own, and a customer who refuses
gets a VerifyError with the code location_required. Show them how to allow
location access and call verify() again.
try {
await tagbase.verify({ baseUrl: 'https://verify.brand.com' })
} catch (error) {
if (error.code === 'location_required') {
// Ask the customer to allow location access, then retry.
}
}Links
TAGBASE maintains this package. Mail us through the support page with feedback or problems.
MIT © TAGBASE
