Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.
This repository has been archived by the owner on May 21, 2022. It is now read-only.

cannot use time.Now().Add(time.Hour * 24).Unix() (type int64) as type *jwt.Time in field value #487

Open
@encryptblockr

Description

Why am i getting this error?

cannot use time.Now().Add(time.Hour * 24).Unix() (type int64) as type *jwt.Time in field value

Here is what i have

import (
	"github.com/gofiber/fiber/v2"
	"golang.org/x/crypto/bcrypt"
	"github.com/dgrijalva/jwt-go/v4"
	"strconv"
	"time"
)

	payload := jwt.StandardClaims{
		Subject: strconv.Itoa(int(user.Id)),
		ExpiresAt: time.Now().Add(time.Hour * 24).Unix(),
	}

	token, err := jwt.NewWithClaims(jwt.SigningMethodHS256, payload).SignedString([]byte("secret"))

What am i doing wrong here???

issue is on this particular line

		ExpiresAt: time.Now().Add(time.Hour * 24).Unix(),

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions