Skip to content

Using Custom HTTP Client

Hemanth Chittanuru edited this page Aug 4, 2020 · 1 revision

Using Custom HTTP Client

MSAL Go uses interfaces called HTTPManager and HTTPManagerResponse to handle its HTTP operations. A default implementation of this interface is provided and is automatically used; however, if you want to use a custom HTTP client, all you need to do is provide implementations of these interfaces.

type HTTPManager interface {
	Get(url string, requestHeaders map[string]string) (HTTPManagerResponse, error)
	Post(url string, body string, requestHeaders map[string]string) (HTTPManagerResponse, error)
}
type HTTPManagerResponse interface {
	GetResponseCode() int
	GetResponseData() string
	GetHeaders() map[string]string
}

After creating implentations of these interfaces, you can just set the HTTPManager of the public/confidential client app instance.

clientApp.SetHTTPManager(customHTTPManager)

Getting Started with MSAL Go

  1. Home
  2. Build and Test
Clone this wiki locally