Change way to find the token
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2019-08-17 19:27:53 +02:00
parent 4c16fda022
commit 627197438a
Signed by: peter
GPG Key ID: 374322D56E5209E8

View File

@ -62,9 +62,12 @@ func WithAuth(handler http.Handler, b *memoryBackend) http.Handler {
return
}
authorization := r.Header.Get("Authorization")
if authorization == "" && strings.Contains(r.URL.Path, "events") {
authorization := ""
if r.Method == http.MethodGet && strings.Contains(r.URL.Path, "events") {
authorization = "Bearer " + r.URL.Query().Get("access_token")
} else {
authorization = r.Header.Get("Authorization")
}
var token auth.TokenResponse