All posts

Tutorial

Preview tokens that expire on their own

Share a draft with a client or a reviewer without publishing it. Preview tokens see drafts, are never cached and stop working by themselves.

Sometimes a draft needs eyes outside the dashboard: a client, a lawyer, a colleague on their phone. Publishing it early is not an option, and a password protected staging site is one more thing to run. ATLAS uses preview tokens instead.

What a preview token is

  • A token of kind preview that always expires. Any member may create one for 1 to 120 minutes.
  • It sees the latest draft of every entry, not only what is live.
  • Its responses are never cached and the page is marked noindex, so a draft cannot leak into a CDN or a search engine.
  • When the time is up it simply stops working. There is nothing to revoke.

Create one

Any member of the brand may create a preview token, editors included, because it shows drafts but changes nothing:

POST /v1/manage/api-tokens
{ "name": "Client review", "kind": "preview", "expires_in_minutes": 30 }

Other token kinds, such as the read token a site uses in production, stay admin only.

Open the draft on the real site

Sites built on @atlas/nuxt ship a preview route. It stores the token in an httpOnly cookie, so the reviewer browses the real site, with the real theme, and sees the draft wherever it appears.

//Keep reading

More from the blog

All posts →

//Run every brand from one place.

Start with one brand for free. Bring your team when you are ready.

$ npm install @atlas/client @atlas/nuxt

Free for one brandNo credit cardUpgrade anytime