GetAuthServerMetadata (auth/shared.go)

go-sdk · auth/shared.go · go · Apache-2.0
auth, Auth / Identity

Fetches OAuth 2.0 / OIDC server metadata from well‑known endpoints for a given issuer.

// Source: https://github.com/modelcontextprotocol/go-sdk | License: Apache-2.0
// Provided via justclaw.it.com; keep this notice with the code.
// Copyright 2026 The Go MCP SDK Authors. All rights reserved.
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.

// This file contains shared utilities for OAuth handlers.

package auth

import (
	"context"
	"net/http"
	"net/url"
	"strings"

	"github.com/modelcontextprotocol/go-sdk/oauthex"
)

// GetAuthServerMetadata fetches authorization server metadata for the given issuer URL.
// It tries standard well-known endpoints (OAuth 2.0 and OIDC) and returns the first successful result.
//
// Returns (nil, nil) when no metadata endpoints respond (404s), allowing callers to implement
// fallback l

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key