Use cookies for authentication instead of header

This replaces the current implementation
where a bearer header holds the auth-token.
Now the same token is being sent using a cookie instead.
This greatly simplifies fetching resources (images and video),
since the header is sent along implicitly with each request.
This commit is contained in:
viktorstrate
2020-07-12 18:52:48 +02:00
parent d681d1538c
commit f669812efb
22 changed files with 246 additions and 217 deletions

View File

@@ -18,6 +18,7 @@ func CORSMiddleware(devMode bool) mux.MiddlewareFunc {
w.Header().Set("Access-Control-Allow-Methods", strings.Join(methods, ","))
w.Header().Set("Access-Control-Allow-Headers", strings.Join(headers, ","))
w.Header().Set("Access-Control-Allow-Credentials", "true")
w.Header().Set("Access-Control-Expose-Headers", "content-length")
endpoint := utils.ApiEndpointUrl()