vikunja-api/pkg/routes/api/v1/token_check.go

19 lines
385 B
Go
Raw Normal View History

2018-06-10 11:11:41 +02:00
package v1
import (
2018-10-31 13:42:38 +01:00
"code.vikunja.io/api/pkg/models"
2018-07-25 17:30:29 +02:00
"fmt"
2018-06-10 11:11:41 +02:00
"github.com/dgrijalva/jwt-go"
"github.com/labstack/echo"
)
// CheckToken checks prints a message if the token is valid or not. Currently only used for testing pourposes.
func CheckToken(c echo.Context) error {
user := c.Get("user").(*jwt.Token)
fmt.Println(user.Valid)
return c.JSON(418, models.Message{"🍵"})
}