Tweak token response for ESA1.0

This commit is contained in:
Matthew Ryan Dillon 2015-10-20 16:22:08 -07:00
parent dd4fbc4cf8
commit 88d1bb5fe4
2 changed files with 7 additions and 5 deletions

View file

@ -13,9 +13,11 @@ var (
Middleware *jwt.Middleware Middleware *jwt.Middleware
// Config handles JWT middleware configuration // Config handles JWT middleware configuration
Config = &jwt.Config{ Config = &jwt.Config{
Secret: os.Getenv("SECRET"), Secret: os.Getenv("SECRET"),
Auth: models.DbAuthenticate, Auth: models.DbAuthenticate,
Claims: claimsFunc, Claims: claimsFunc,
IdentityField: "username",
VerifyField: "password",
} }
) )

View file

@ -64,7 +64,7 @@ func tokenHandler(h http.Handler) http.Handler {
}) })
} else { } else {
data, _ = json.Marshal(struct { data, _ = json.Marshal(struct {
Token string `json:"token"` Token string `json:"access_token"`
}{ }{
Token: tokenData, Token: tokenData,
}) })
@ -92,7 +92,7 @@ func tokenRefresh(j *jwt.Middleware) errorHandler {
} }
data, _ := json.Marshal(struct { data, _ := json.Marshal(struct {
Token string `json:"token"` Token string `json:"access_token"`
}{ }{
Token: token, Token: token,
}) })