examples/

directory
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: MIT

README

Examples

Small runnable programs that use the 9in Go SDK. Each reads its settings from NINE_* environment variables.

Folder What it shows
webapp Sign-in for a server-rendered app with nine.WebApp: /nine/login, /nine/callback, /nine/logout, a protected page and a call to your API with the user's access token
api An API protected with nine.RequireAuth (hybrid verification) and a webhook endpoint that evicts revoked tokens
adapter Keeping users in your own database: the adapter protocol endpoints over an in-memory user list
device A CLI that signs in with the device flow
# Regular Web App with http://localhost:3000/nine/callback as a callback URL
# and http://localhost:3000/ as a logout URL
export NINE_ISSUER=https://acme.9in.io NINE_CLIENT_ID=app_… NINE_CLIENT_SECRET=…
export NINE_SECRET="$(openssl rand -base64 32)" NINE_BASE_URL=http://localhost:3000
go run ./examples/webapp

Directories

Path Synopsis
Command adapter keeps users in your own database: it serves the adapter protocol endpoints 9in calls (…/authenticate, …/user, …/event) over an in-memory user list.
Command adapter keeps users in your own database: it serves the adapter protocol endpoints 9in calls (…/authenticate, …/user, …/event) over an in-memory user list.
Command api is an API protected with 9in access tokens, with a webhook endpoint that keeps hybrid verification current.
Command api is an API protected with 9in access tokens, with a webhook endpoint that keeps hybrid verification current.
Command device signs in from a terminal with the device flow (RFC 8628).
Command device signs in from a terminal with the device flow (RFC 8628).
Command webapp is a server-rendered web app that signs users in with 9in.
Command webapp is a server-rendered web app that signs users in with 9in.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL