mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-10 03:56:00 +08:00
Merge branch 'tuoyun' of github.com:OpenIMSDK/Open-IM-Server into tuoyun
This commit is contained in:
@@ -202,6 +202,21 @@ func VerifyToken(token, uid string) (bool, error) {
|
||||
if claims.UID != uid {
|
||||
return false, &constant.ErrTokenUnknown
|
||||
}
|
||||
|
||||
log.NewDebug("", claims.UID, claims.Platform)
|
||||
return true, nil
|
||||
}
|
||||
func WsVerifyToken(token, uid string, platformID string) (bool, error, string) {
|
||||
claims, err := ParseToken(token)
|
||||
if err != nil {
|
||||
return false, err, "parse token err"
|
||||
}
|
||||
if claims.UID != uid {
|
||||
return false, &constant.ErrTokenUnknown, "uid is not same to token uid"
|
||||
}
|
||||
if claims.Platform != constant.PlatformIDToName(utils.StringToInt32(platformID)) {
|
||||
return false, &constant.ErrTokenUnknown, "platform is not same to token platform"
|
||||
}
|
||||
log.NewDebug("", claims.UID, claims.Platform)
|
||||
return true, nil, ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user