Skip to content

Commit 2b57c6f

Browse files
committed
jwt: add method for get access_token from cookies
1 parent 3aa7bd3 commit 2b57c6f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

design/ga-design.graffle/data.plist

-2.31 KB
Binary file not shown.

middlewares/jwt/utils.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,16 @@ func getIDToken(req *http.Request) string {
5656
}
5757
}
5858

59+
// from cookies
60+
if cookie, err := req.Cookie("access_token"); err == nil {
61+
return cookie.Value
62+
}
63+
5964
// Fetch access_token from URL query param
6065
idToken := req.URL.Query().Get("access_token")
61-
req.URL.Query().Del("access_token")
66+
if idToken != nil {
67+
req.URL.Query().Del("access_token")
68+
}
6269
return idToken
6370
}
6471

0 commit comments

Comments
 (0)