コード例 #1
0
        public string GetOfflineToken(long userId)
        {
            var now = SystemTime.Now();

            var timeStamp = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second, DateTimeKind.Utc);

            var signature = new SignatureBuilder().Append(userId).Append(_applicationSettings.AppId).Append(timeStamp).Append(_applicationSettings.AppSecret).Sign();

            var serviceParameters = new NameValueCollection(4)
            {
                { "userId", userId.ToString() },
                { "appId", _applicationSettings.AppId.ToString() },
                { "timestamp", timeStamp.ToString("yyyy-MM-ddTHH:mm:ss") },
                { "signature", signature }
            };

            return(_platformProxy.GetOfflineToken(_servicePath + "/get-token", serviceParameters));
        }