1
0

feat: add long-lived api tokens (#1085)

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/api/pulls/1085
Co-authored-by: konrad <k@knt.li>
Co-committed-by: konrad <k@knt.li>
This commit is contained in:
konrad
2022-02-06 13:18:08 +00:00
parent 2598550e49
commit 1322cb16d7
11 changed files with 51 additions and 8 deletions

View File

@ -102,7 +102,7 @@ func Login(c echo.Context) error {
}
// Create token
return auth.NewUserAuthTokenResponse(user, c)
return auth.NewUserAuthTokenResponse(user, c, u.LongToken)
}
// RenewToken gives a new token to every user with a valid token
@ -156,6 +156,12 @@ func RenewToken(c echo.Context) (err error) {
return handler.HandleHTTPError(err, c)
}
var long bool
lng, has := claims["long"]
if has {
long = lng.(bool)
}
// Create token
return auth.NewUserAuthTokenResponse(user, c)
return auth.NewUserAuthTokenResponse(user, c, long)
}