2 Star 1 Fork 0

zegodev/zego_server_assistant

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
sample-base.go 953 Bytes
Copy Edit Raw Blame History
Joey Chen authored 2022-05-20 14:49 . Rename sample.go to sample-base.go
package main
import (
"fmt"
"github.com/zegoim/zego_server_assistant/token/go/src/token04"
)
/*
基础鉴权token生成示例代码
*/
func main() {
// 请将 appId 修改为你的 appId,appid 为数字,从即构控制台获取
// 举例:1234567890
var appId uint32 = 1234567890
// 请修改为你的 serverSecret,serverSecret 为字符串,从即构控制台获取
// 举例: "fa94dd0f974cf2e293728a526b028271"
serverSecret := ""
// 请将 userId 修改为用户的 user_id
userId := "user1"
// token 的有效时长,单位:秒
var effectiveTimeInSeconds int64 = 3600
// token业务认证扩展,基础鉴权token此处填空字符串
var payload string = ""
//生成token
token, err := token04.GenerateToken04(appId, userId, serverSecret, effectiveTimeInSeconds, payload)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(token)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zegodev_admin/zego_server_assistant.git
git@gitee.com:zegodev_admin/zego_server_assistant.git
zegodev_admin
zego_server_assistant
zego_server_assistant
release/github

Search