Docs Version v0.2
Docs menu

Connect your application

Quickstart: a Go application

Changed 3 min readv0.2

On this page

Introduction

This guide connects a Go application to Signari, so that people sign in to it with their Signari account. The example, examples/go-quickstart, on GitHub, uses nothing outside Go's standard library. It is about two hundred lines.

Because it uses no library, it shows everything an application has to check itself: the authorization code flow with Proof Key for Code Exchange (PKCE), then the ID token's signature against the published keys, its issuer, audience, expiry and nonce.

You register the application, run the example, and sign in. The last sections explain what the example does at each step, and why.

Note

New to Signari? Your first application runs this example and five others on your own computer, with nothing to register by hand.

1. Register the application

Register the example as a confidential client, with the address it listens on as its redirect URI:

Shellsignari client create -org <org-id> -client-id quickstart -name Quickstart \  -redirect http://127.0.0.1:8080/callback

It prints the client secret once. Keep it. A redirect URI is matched exactly: scheme, host, port and path.

2. Run it

Run the example with Signari's address and the values from step 1:

Shellcd examples/go-quickstartSIGNARI_ISSUER=https://id.example.com CLIENT_ID=quickstart CLIENT_SECRET=<the secret> \  REDIRECT_URI=http://127.0.0.1:8080/callback go run .

Open http://127.0.0.1:8080/login, sign in, and the page says who signed in.

In compose

The demo profile of deploy/docker-compose.yml runs this example from its Dockerfile, on GitHub as demo, the public client demo of deploy/demo/client.yaml, on GitHub, at http://localhost:8097/login. Your first application gives the commands. It trusts the development CA under deploy/tls through SSL_CERT_FILE. The same profile runs the Express, Next.js, Django, Spring Boot and Laravel quickstarts beside it, on ports 8091 to 8095.

What it does, and why each step is there

  1. Discovery. It reads /.well-known/openid-configuration and refuses to start when the issuer there is not the one configured. An application that took another issuer would accept tokens minted for someone else.
  2. The redirect out. /login makes a fresh state, nonce and PKCE verifier for this one sign-in, keeps them, puts the state in a cookie for the callback's path, and sends the browser to the authorization endpoint with the verifier's SHA-256 as code_challenge and code_challenge_method=S256. Signari requires PKCE of every client by default, confidential ones included, and accepts only S256.
  3. The callback. It takes the state back once, and only from the browser whose cookie holds it. Without the cookie, somebody could begin a sign-in, stop at the callback and send that link to you, and you would be signed in as them. It sends the code, the same redirect_uri and the verifier to the token endpoint, authenticating with client_secret_basic, each half form-encoded first, as Signari decodes them.
  4. The ID token. It checks the signature with the key the token's kid names, from jwks_uri (ES256 by default; RS256 for a client set to it), then iss, aud, exp and nonce. Only then does it believe who signed in.

A public client, such as a single-page or native application, has no secret. Leave CLIENT_SECRET unset and register it with -public, and it sends its client_id with the code instead. PKCE is then its only proof.

When something is refused, the message is Signari's own. What each one means is in Troubleshooting.

Verified

Run against a running engine: discovery, PKCE S256, the sign-in, the code exchanged for tokens, and an ES256 ID token verified against the published key, ending in "Signed in as …". With the signature check broken on purpose, the same sign-in is refused with "no published key verifies it".

Since 29 November 2026, continuous integration (CI) runs this example in the compose stack's demo profile whenever it, the stack or the engine changes, and once a week. A new person signs in to it in Chrome, with a password and then by single sign-on, and the run fails unless the application says "Signed in as" them. The job is .github/workflows/quickstarts.yml.