Fixed incorrect types
This commit is contained in:
parent
ff2b763907
commit
88461ea03d
@ -1,6 +1,6 @@
|
|||||||
[auth]
|
[auth]
|
||||||
# JWT secret
|
# JWT secret
|
||||||
secret = "a key"
|
secret = "a secret"
|
||||||
# Disable registration
|
# Disable registration
|
||||||
disabled = false
|
disabled = false
|
||||||
# bcrypt cost
|
# bcrypt cost
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Encode a token
|
// Encode a token
|
||||||
func Encode(id int) (string, error) {
|
func Encode(id int64) (string, error) {
|
||||||
// Get time
|
// Get time
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
|
@ -3,15 +3,15 @@ package jwt
|
|||||||
import "github.com/golang-jwt/jwt"
|
import "github.com/golang-jwt/jwt"
|
||||||
|
|
||||||
// JWT secret
|
// JWT secret
|
||||||
var secret string
|
var secret []byte
|
||||||
|
|
||||||
// JWT claims
|
// JWT claims
|
||||||
type Claims struct {
|
type Claims struct {
|
||||||
jwt.StandardClaims
|
jwt.StandardClaims
|
||||||
ID int `json:"id"` // User ID
|
ID int64 `json:"id"` // User ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the JWT secret
|
// Set the JWT secret
|
||||||
func New(sec string) {
|
func New(sec string) {
|
||||||
secret = sec
|
secret = []byte(sec)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user