mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-07 02:26:00 +08:00
feat: ver3 branch
Signed-off-by: kubbot & kubecub <3293172751ysy@gmail.com>
This commit is contained in:
@@ -32,7 +32,7 @@ func BuildClaims(uid string, platformID int, ttl int64) Claims {
|
||||
|
||||
func secret() jwt.Keyfunc {
|
||||
return func(token *jwt.Token) (interface{}, error) {
|
||||
return []byte(config.Config.TokenPolicy.AccessSecret), nil
|
||||
return []byte(config.Config.Secret), nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
)
|
||||
|
||||
func Test_ParseToken(t *testing.T) {
|
||||
config.Config.TokenPolicy.AccessSecret = "OpenIM_server"
|
||||
config.Config.Secret = "OpenIM_server"
|
||||
claims1 := BuildClaims("123456", constant.AndroidPadPlatformID, 10)
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims1)
|
||||
tokenString, err := token.SignedString([]byte(config.Config.TokenPolicy.AccessSecret))
|
||||
tokenString, err := token.SignedString([]byte(config.Config.Secret))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user