@@ 12,8 12,18 @@ import (
"hg.code.netlandish.com/~netlandish/gobwebs/crypto"
)
-// TokenVersion ...
-const TokenVersion uint = 0
+const (
+ // TokenVersion ...
+ TokenVersion uint = 0
+
+ // Token types
+
+ // TypePersonal ...
+ TypePersonal string = "PERSONAL"
+
+ // TypeOAuth2 ...
+ TypeOAuth2 string = "OAUTH2"
+)
// Timestamp ...
type Timestamp int64
@@ 96,6 96,7 @@ func (s *Service) AddPersonal(c echo.Context) error {
grant := BearerToken{
Version: TokenVersion,
+ Type: TypePersonal,
Issued: ToTimestamp(issued),
Expires: ToTimestamp(expires),
Grants: "",
@@ 575,7 576,7 @@ func (s *Service) AccessTokenPOST(c echo.Context) error {
bt := BearerToken{
Version: TokenVersion,
- Type: "OAUTH2",
+ Type: TypeOAuth2,
Issued: ToTimestamp(issued),
Expires: ToTimestamp(expires),
Grants: payload.Grants,