Skip to content

Commit 1481890

Browse files
author
thisisaaronland
committed
various fixes to make AppendAccessTokenFromCookieHandler work
1 parent e8632fa commit 1481890

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

www/cookie.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,14 @@ func OAuth2RemoveAccessTokenCookieHandler(opts *oauth2.Options) (http.Handler, e
276276
return h, nil
277277
}
278278

279-
func AppendAccessTokenHandler(opts *oauth2.Options, next_handler http.Handler) http.Handler {
279+
func AppendAccessTokenFromCookieHandler(opts *oauth2.Options, next_handler http.Handler) http.Handler {
280280

281281
fn := func(rsp http.ResponseWriter, req *http.Request) {
282282

283-
token, err := GetOAuth2TokenFromCookie(opts, req)
283+
token, _ := GetOAuth2TokenFromCookie(opts, req)
284284

285-
if err != nil {
286-
// http.Error(rsp, err.Error(), http.StatusInternalServerError)
285+
if token == nil {
286+
next_handler.ServeHTTP(rsp, req)
287287
return
288288
}
289289

@@ -311,6 +311,10 @@ func NewAccessTokenRewriteFunc(token *goog_oauth2.Token) rewrite.RewriteHTMLFunc
311311
token_attr := html.Attribute{token_ns, token_key, token_value}
312312
n.Attr = append(n.Attr, token_attr)
313313
}
314+
315+
for c := n.FirstChild; c != nil; c = c.NextSibling {
316+
rewrite_func(c, w)
317+
}
314318
}
315319

316320
return rewrite_func

0 commit comments

Comments
 (0)