我正在尝试使用带有JWT的Opentok REST API来生成视频会话令牌。按照https://github.com/kylef/JSONWebToken.swift上的JSONWebToken文档,我使用以下凭据来创建JWT。
我已经使用生成的令牌进行授权,并遵循https://tokbox.com/developer/rest/#authentication上的文档,并从postman调用了api,但我收到了无效签名错误消息。我哪里错了?

var claims = ClaimSet()
claims["iss"] = "3*****2"
claims["ist"] = "account"
claims["iat"] = (Calendar.current.date(byAdding: .minute, value: 330, to: Date())?.timeIntervalSince1970)!
claims["exp"] = (Calendar.current.date(byAdding: .minute, value: 334, to: Date())?.timeIntervalSince1970)!
claims["jti"] = "\(NSUUID.init())"
claims["aud"] = "www.example.com"
let jToken = JWT.encode(claims: claims, algorithm: .hs256("334******************************d5af".data(using: .utf8)!))
print(jToken)发布于 2018-07-10 21:44:04
在"X-OPENTOK-AUTH“的Value字段中,你首先需要写下:"Bearer”+ token。如果不起作用,请尝试将"X-OPENTOK-AUTH“改为"Authorization”。
https://stackoverflow.com/questions/43992538
复制相似问题