{{ template "meta" }} Add a YubiKey
{{ template "brand" .Hostname }}
← Back

Add a YubiKey

{{ if .Error }} {{ end }} {{ template "flashes" .flashes }} {{ if .EmailOnly }}

Your account currently uses emailed sign-in codes. Adding this replaces them, so first confirm you can read your email.

{{ end }} {{ if .YubiCloud }}

Fill in the fields below, then click in the YubiKey box and touch your key. It types a code and submits the form. Signing in works the same way: touch your key in the box that asks for a code.

{{ if .EmailOnly }} {{ else if .HasCredentials }} {{ end }}
{{ else }}

This server isn't set up to check YubiKeys with Yubico, so your key needs a slot programmed with a secret key only you and this server know. With YubiKey Manager installed, run:

ykman otp yubiotp --serial-public-id --generate-private-id --generate-key 2

This programs slot 2 (used with a long touch) and leaves slot 1 as it is. Copy the printed secret key below. Don't use --upload.

Server operators: set COCOON_YUBICO_CLIENT_ID and COCOON_YUBICO_API_KEY to let people add a YubiKey just by touching it.

{{ if .EmailOnly }} {{ else if .HasCredentials }} {{ end }}
{{ end }}