code: func (a *authenticator) getTokenFor(credentials *credentials) (string, int, error) {
  	name, errCode, err := a.validateCredentials(credentials)
  	if err != nil {
  		return "", errCode, err
  	}
  	claims := jwt.StandardClaims{
  		Audience:  name,
  		ExpiresAt: a.expTime.Nanoseconds(),
  	}
  	token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
  	tokenString, err := token.SignedString([]byte(signature))
  	if err != nil {
  		return "", http.StatusInternalServerError, fmt.Errorf("500 internal server error: failed to sign token: %v", err)
  	}
  	a.userDb.SetLoginTime(name)
  	a.log.Debugf("user %s was logged in", name)
  
  	return tokenString, 0, nil
  }
docs: // Get token for credentials