Library/routes/api/v1/token_check.go

19 lines
392 B
Go
Raw Normal View History

package v1
import (
"fmt"
2018-03-05 11:53:12 +00:00
"git.kolaente.de/konrad/Library/models"
2017-11-07 15:35:10 +00:00
"github.com/dgrijalva/jwt-go"
"github.com/labstack/echo"
)
2017-11-08 09:55:17 +00:00
// CheckToken checks prints a message if the token is valid or not. Currently only used for testing pourposes.
func CheckToken(c echo.Context) error {
2017-11-07 15:35:10 +00:00
user := c.Get("user").(*jwt.Token)
fmt.Println(user.Valid)
2017-12-01 11:38:09 +00:00
return c.JSON(418, models.Message{"🍵"})
2017-11-07 15:35:10 +00:00
}