Skip to main content
Mentra Miniapp SDK betaThe SDK is in beta, so its APIs may change before general availability.To put a miniapp in front of users, host it at an HTTPS URL and share the link, or get it listed in the Mentra Miniapp Store. See Publish your miniapp.Developing on Mentra Live? We recommend using the Mentra Bluetooth SDK.The developer tools are available in the Mentra App under Settings → Miniapp Developer Settings.Share feedback with an in-app bug report, on Discord, or by email at help@mentra.glass.
If your miniapp has a website, people can sign in to it with the Mentra account they use on their glasses. Your site then gets the same token your miniapp gets on the phone (Auth), so your backend sees the same user and reaches the same data. There are no passwords for you to store. It is standard OpenID Connect, so any OIDC client library works.

Get started

1. Register your website

  1. Install your miniapp once in the Mentra App from its URL, so Mentra knows it.
  2. Sign in to the Mentra Developer Console and open Websites.
  3. Enter your miniapp’s package name and your site’s redirect URI, then Register website.
You get a client ID and, for a site with a server, a client secret. The secret is shown once: keep it on your server.
A website signs people in for a miniapp only from the domain the miniapp’s name belongs to. com.example.notes belongs to example.com, so its website’s redirect URIs must be on example.com or one of its subdomains. It is the same rule that decides where a miniapp can be served from.

2. Send people to Mentra and take them back

Use the authorization code flow with PKCE. With openid-client on your server:
The first time, Mentra asks the person to allow your site. After that they go straight through.

3. Use the token on your backend

tokens.access_token is the person’s miniapp token for your package. Verify it with @mentra/auth, exactly as for a request from the phone:
Then start your own session for that user. Don’t put the token in a URL or in localStorage.

Tokens

Refresh with oidc.refreshTokenGrant(config, refreshToken). A refresh is also when Mentra tells you things have changed: if the person revoked your site, or your miniapp was archived, it answers with an error and you should sign them out. A 503 means “try again”, not “no”.

What your backend can tell

Site types

Develop on your own computer

Register a second website with Environment: Development and a redirect URI on your machine, such as http://127.0.0.1:5173/callback. A development website signs in only you.

Signing out, and being signed out

  • To sign someone out of your site, end your own session and revoke the refresh token with oidc.tokenRevocation(config, refreshToken).
  • People see the sites they have allowed, and can revoke any of them, under Connected apps on account.mentraglass.com. Your next refresh then fails.