MCPcopy
hub / github.com/dghubble/gologin / EmptyTempHandler

Function EmptyTempHandler

oauth1/login.go:100–110  ·  view source on GitHub ↗

EmptyTempHandler adds an empty request token secret to the ctx if none is present to support OAuth1 providers which do not require temp secrets to be kept between the login phase and callback phase.

(success http.Handler)

Source from the content-addressed store, hash-verified

98// present to support OAuth1 providers which do not require temp secrets to
99// be kept between the login phase and callback phase.
100func EmptyTempHandler(success http.Handler) http.Handler {
101 fn := func(w http.ResponseWriter, req *http.Request) {
102 ctx := req.Context()
103 _, _, err := RequestTokenFromContext(ctx)
104 if err != nil {
105 ctx = WithRequestToken(ctx, "", "")
106 }
107 success.ServeHTTP(w, req.WithContext(ctx))
108 }
109 return http.HandlerFunc(fn)
110}
111
112// CallbackHandler handles OAuth1 callback requests by parsing the oauth token
113// and verifier, reading the request token secret from the ctx, then obtaining

Callers

nothing calls this directly

Calls 2

RequestTokenFromContextFunction · 0.85
WithRequestTokenFunction · 0.85

Tested by

no test coverage detected