The Go SDK package provides an interface for interacting with NuID APIs and utilities. We encourage you to go read the package docs and contact us if you have any questions. We also encourage you to open an issue or pull request if you have any issues or suggestions.


Install the package from our GitHub source. Be sure to add your API Key to your environment configuration.

$ cd my-go-app
$ GO111MODULE=on go get

# Add the API key and host to your environment configuration
$ export NUID_API_KEY="<API KEY>"


To use the package, import it into your server and configure it:

// server.go
package main

import (


	"" // import the auth package

type Server struct {
	db *gorm.DB
	api *auth.APIClient

func main() {
	srv := &Server{
		// Configure the package with your API Key
		api: auth.NewAPIClient(os.Getenv("NUID_API_KEY")),
		db: initDB(),
	mux := http.NewServeMux()
	mux.HandleFunc("/register", srv.registerHandler)
	mux.HandleFunc("/challenge", srv.challengeHandler)
	mux.HandleFunc("/login", srv.loginHandler)
	port := os.Getenv("PORT")
	addr := "" + port
	server := &http.Server{
		Addr: addr,
		Handler: cors.Default().Handler(mux),
	fmt.Printf("Listening at %s\n", addr)

Once you have a configured sdk client, you can use it to dispatch requests to the API with all the go error handling semantics you know and love.

// Create the NuID Credential on the API
_, credentialBody, err := srv.api.CredentialCreate(body.Credential)
if err != nil || credentialBody == nil{
	requestFailed(res, 500, "Unable to create credential")

You can see a complete code example using the Go SDK in our examples repo, or go read our Integrating with NuID guide.