Skip to content

Commit

Permalink
fix login for addauth
Browse files Browse the repository at this point in the history
  • Loading branch information
gwind committed Feb 1, 2019
1 parent 6669e42 commit 9e4f514
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions middlewares/addauth/addauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ import (

"github.com/codegangsta/negroni"
"github.com/ooclab/ga/service"
"github.com/Sirupsen/logrus"
)

type addauthMiddleware struct {
app *service.App
}

func (h *addauthMiddleware) ServeHTTP(w http.ResponseWriter, req *http.Request, next http.HandlerFunc) {
if err := h.app.CheckAccess(); err != nil {
logrus.Warnf("app access failed: %s\n", err)
}
// do some stuff before
if h.app.AccessToken != "" {
req.Header["Authorization"] = []string{fmt.Sprintf("Bearer %s", h.app.AccessToken)}
Expand Down

0 comments on commit 9e4f514

Please sign in to comment.