You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-security/docs/Jwt.md

638 B

JWT

安装

go get git.tsl3060.com/openapi/go-security/jwt

将包放在你的项目文件夹下,并在 import 中添加以下内容:

import jwt "git.tsl3060.com/openapi/go-security/jwt"

基本使用

获取服务器公钥

访问https://opendev.tsl3060.com/certs/publickey以获取服务器公钥

配置并使用示例

// 设置公钥
service, err := jwt.NewTokenService("public key")
if err != nil {
    return
}
// 校验解析token
token, err := service.VerifyToken("token")
if err != nil {
    return
}
fmt.Println(token)