24 lines
655 B
Go
24 lines
655 B
Go
package token
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/authorizerdev/authorizer/server/constants"
|
|
"github.com/authorizerdev/authorizer/server/envstore"
|
|
"github.com/golang-jwt/jwt"
|
|
)
|
|
|
|
// CreateVerificationToken creates a verification JWT token
|
|
func CreateVerificationToken(email, tokenType, hostname string) (string, error) {
|
|
claims := jwt.MapClaims{
|
|
"exp": time.Now().Add(time.Minute * 30).Unix(),
|
|
"iat": time.Now().Unix(),
|
|
"token_type": tokenType,
|
|
"email": email,
|
|
"host": hostname,
|
|
"redirect_url": envstore.EnvInMemoryStoreObj.GetStringStoreEnvVariable(constants.EnvKeyAppURL),
|
|
}
|
|
|
|
return SignJWTToken(claims)
|
|
}
|