package devicemngmt import ( "time" "github.com/dgrijalva/jwt-go" "go.mongodb.org/mongo-driver/bson/primitive" ) func (s Service) generateAuthToken(userID primitive.ObjectID) string { token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ "_id": userID, "exp": now().Add(time.Second * 15552000).Unix(), // 6 months }) tokenString, _ := token.SignedString([]byte(s.AuthSecret)) return tokenString }