diff options
-rw-r--r-- | server/main.go | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/server/main.go b/server/main.go index 4f1cbd6..786fc9f 100644 --- a/server/main.go +++ b/server/main.go @@ -152,13 +152,10 @@ func callbackHandler(a *appContext, w http.ResponseWriter, r *http.Request) (int // rootHandler starts the auth process. If the client is authenticated it renders the token to the user. func rootHandler(a *appContext, w http.ResponseWriter, r *http.Request) (int, error) { tok := a.getAuthCookie(r) - if !tok.Valid() { + if !tok.Valid() || !a.authprovider.Valid(tok) { http.Redirect(w, r, "/auth/login", http.StatusSeeOther) return http.StatusSeeOther, nil } - if !a.authprovider.Valid(tok) { - return http.StatusUnauthorized, errors.New(http.StatusText(http.StatusUnauthorized)) - } j := jwt.New(jwt.SigningMethodHS256) j.Claims["token"] = tok.AccessToken j.Claims["exp"] = tok.Expiry.Unix() |