Skip to content
Trustaige Docs

Add the Trustaige button

One script tag draws the Trustaige button on your own link, in your page's shape, and tells people when their browser can't sign in.

View as Markdown

The Trustaige button is your own link, drawn by one script from Trustaige. The link goes to your sign-in route, which starts the OpenID Connect request from your server as in Sign up with a button. It keeps working if the script doesn’t load; the script only draws it.

Add it

<script src="https://id.trustaige.com/signin-button.js" defer></script>

<a href="/auth/login" data-trustaige-button="sign-in">Sign in with Trustaige</a>

The script draws every link or button marked data-trustaige-button, including ones your app adds after the page loads. A <button> in a form works the same way as a link.

If your site sets a Content Security Policy, add https://id.trustaige.com to its script-src.

<script src="https://id.trustaige.com/signin-button.js" defer></script>

<a href="/auth/login" data-trustaige-button="sign-in">Sign in with Trustaige</a>

Choose the label

data-trustaige-buttonThe button readsUse it on
sign-inSign in with TrustaigeYour sign-in page
sign-upSign up with TrustaigeYour sign-up page. Its route sends prompt=create.
continueContinue with TrustaigeA single button for both, or the last step after your own form

The script draws the label, so the button reads the same in every app.

In a row of providers

Most sign-in pages put other providers in a row under Or continue with. Add data-placement="row" and the button shows the mark and the name alone, fills its cell, and matches the white buttons beside it. Screen readers still announce “Continue with Trustaige”.

<p class="divider">Or continue with</p>
<div class="providers">
  <a href="/auth/other">…</a>
  <a href="/auth/login" data-trustaige-button="continue" data-placement="row">
    Continue with Trustaige
  </a>
</div>
<p class="divider">Or continue with</p>
<div class="providers">
  <a href="/auth/other">…</a>
  <a href="/auth/login" data-trustaige-button="continue" data-placement="row">
    Continue with Trustaige
  </a>
</div>

Style, size and corners

SettingValuesDefault
data-styleink, paperPaper in a row of providers. Ink where Trustaige is the main way in, and Paper on a dark page.
data-sizelg (48px), md (44px), sm (36px)md
data-widthfitFills its container on screens narrower than 480px
--trustaige-radiusAny CSS length8px

Set --trustaige-radius to your own buttons’ corners, so the Trustaige button matches them:

:root { --trustaige-radius: 12px; }
:root { --trustaige-radius: 12px; }

Browsers that can’t sign in with Trustaige

Some browsers built into other apps can’t sign in with Trustaige. In those, the script disables the button and shows one note below it, Open this page in your browser, with a button that copies the page’s address.

To show your own message instead, listen for trustaige-button:unavailable and cancel it. Add the listener before the script tag, because the event fires as the button is drawn.

<script>
  document.addEventListener('trustaige-button:unavailable', (event) => {
    event.preventDefault();
    showYourOwnMessage();
  });
</script>
<script src="https://id.trustaige.com/signin-button.js" defer></script>
<script>
  document.addEventListener('trustaige-button:unavailable', (event) => {
    event.preventDefault();
    showYourOwnMessage();
  });
</script>
<script src="https://id.trustaige.com/signin-button.js" defer></script>

Keeping it recognisable

  • Keep the label and mark the script draws, in their own colours.
  • In a row of providers, give the button the same size as the ones beside it.
  • Name Trustaige, not the method, in any text around the button, as in Name Trustaige on the button.

Next: offer an account by link.