Documentation ¶
Index ¶
Constants ¶
const (
RefreshURL = "/oauth/refresh"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChiMiddleware ¶
type ChiMiddleware struct {
// contains filtered or unexported fields
}
ChiMiddleware is a handler that exposes prometheus metrics for the number of requests, the latency and the response size, partitioned by status code, method and HTTP path.
func NewChiMiddleware ¶
func NewChiMiddleware(name string, buckets ...float64) *ChiMiddleware
NewMiddleware returns a new prometheus ChiMiddleware handler.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) RefreshCallback ¶
func (h *Handler) RefreshCallback(w http.ResponseWriter, r *http.Request)
Token refresh helper endpoint. Takes a valid oauth2 token containing an access code and a refresh token, and returns a fresh token in return.
func (*Handler) ServeCallback ¶
func (h *Handler) ServeCallback(w http.ResponseWriter, r *http.Request)
Callback URL of oauth2 client credentials flow. Check the XSRF cookie and exchange the authentication code from the URL with an access token using Spotify's oauth2 API. The token is returned back to the user, for use in the client.
func (*Handler) ServeLogin ¶
func (h *Handler) ServeLogin(w http.ResponseWriter, r *http.Request)
First step of oauth2 client credentials flow. Store a cookie in the user's browser with the XSRF protection token, then redirect to Spotify's authentication URL.
type JSONRenderer ¶
type JSONRenderer struct{}
func (*JSONRenderer) Render ¶
func (r *JSONRenderer) Render(w http.ResponseWriter, code int, err error, token *oauth2.Token)
type TextRenderer ¶
type TextRenderer struct{}
func (*TextRenderer) Render ¶
func (r *TextRenderer) Render(w http.ResponseWriter, code int, err error, token *oauth2.Token)