go-http-digest

module
v0.0.0-...-cffc47d Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0

README

HTTP Digest Authentication

GoDoc

Simple digest auth

package main

import (
	"net/http"
    	"os"
	"github.com/jpfielding/go-http-digest/pkg/digest"
)

func main() {
    // helper to create the default-ish transport
    transport := digest.DefaultHTTPTransport()
    dt := digest.NewTransport("user", "pwd", transport)
    client := dt.NewHTTPClient()
    client.Jar, _ = cookiejar.New(nil)
    // SHA-256 requrired for mongodbgov.com
    res, _err_ := client.Get("https://cloud.mongodbgov.com/api/atlas/v1.0/groups/<proj>/clusters/<cluster-name>")
    io.Copy(os.Stdout, res.Body)
    if err != nil {
        panic(err)
    }
    defer res.Body.Close()
}

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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