Example #1
0
func setToken(w http.ResponseWriter, user *quimby.User) {
	token, err := quimby.GenerateToken(user.Username, exp)
	if err != nil {
		w.WriteHeader(http.StatusUnauthorized)
	} else {

		w.Header().Set("Authorization", token)
	}
}
Example #2
0
func GetToken() {
	var n string
	fmt.Printf("username: "******"%s", &n)
	token, err := quimby.GenerateToken(n, math.MaxInt64)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(token)
}