[英]Sinch backend-generated token for Javascript and Android clients
I'm finding two different methods to generate the sinch auth token in an app server. 我发现了两种不同的方法来在应用服务器中生成sinch auth令牌。 One for the Android client and a different one for the JS client.
一个用于Android客户端,另一个用于JS客户端。 Is it possible to use the same token for both the android and JS clients?
android和JS客户端都可以使用相同的令牌吗?
For android I see https://www.sinch.com/docs/voice/android/#authenticationsupportedbyapplicationserver which is described as using a nonce and a signature derived from 对于Android,我可以看到https://www.sinch.com/docs/voice/android/#authenticationsupportedbyapplicationserver ,它被描述为使用随机数和派生自其的签名
string stringToSign = userId + applicationKey + sequence + applicationSecret;
字符串stringToSign = userId + applicationKey +序列+ applicationSecret;
Here the response from the backend needs to have the token and the nonce and then in the android client 在这里,来自后端的响应需要具有令牌和随机数,然后在android客户端中
registrationCallback.register(signature, nonce);
registrationCallback.register(signature,nonce);
For javascript it is completely different https://github.com/sinch/sinch-js-ticketgen/blob/master/index.js . 对于javascript,这是完全不同的https://github.com/sinch/sinch-js-ticketgen/blob/master/index.js 。
The token is generated from a json object like this 令牌是从这样的json对象生成的
{
'applicationKey': appKey,
'identity': {'type': 'username', 'endpoint': user['username']},
'created': timestamp || (new Date()).toISOString(),
'expiresIn': 86400, //24 hour default expire
}
where the result is a json with a userToken
field with userTicketBase64 + ':' + signature
. 其中的结果是一个带有
userToken
字段且带有userTicketBase64 + ':' + signature
的json。 And then in the JS client 然后在JS客户端中
sinchClient.start(backendResponse)
This is confusing, do both clients really need completely different authentication tokens? 这令人困惑,两个客户端是否真的需要完全不同的身份验证令牌? if not, how can I generate one that works for both and how can I initialize the two different clients?
如果没有,如何生成一个对两个都适用的客户端,以及如何初始化两个不同的客户端?
无法以一种在两种平台上都能使用的单一方式生成令牌
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.