Older documentation. Start with the current guides.

Authentication

Go Micro provides a pluggable authentication interface that covers JWT tokens, account management, scoped access control, and custom auth providers.

Overview

The auth package in go-micro.dev/v6/auth defines the core interfaces:

Quick Start

import "go-micro.dev/v6/auth"

// Use the default auth implementation
a := auth.DefaultAuth

// Generate a token
tok, err := a.Generate("admin")
if err != nil {
    // handle error
}

// Validate a token
account, err := a.Inspect(tok.Token)
if err != nil {
    // handle error
}

Next Steps