Esempio n. 1
0
        /// <summary>
        /// 获取AccessToken, RefreshToken
        /// </summary>
        public static string GetToken()
        {
            try
            {
                QianmiContext context = OAuthUtils.GetToken(APP_KEY, APP_SECRET, AUTHORIZE_CODE);

                return(string.Format("{0},{1}", context.Token.AccessToken, context.Token.RefreshToken));
            }
            catch (Exception ex)
            {
                ETong.Log.Sdk.LoggerMgr.GetLogger <Authorize>().ErrorExt("获取token时返回异常:" + ex);
            }
            return(string.Empty);
        }
Esempio n. 2
0
        /// <summary>
        /// 刷新AccessToken, RefreshToken
        /// </summary>
        public static void RefreshToken()
        {
            try
            {
                QianmiContext context = OAuthUtils.RefreshToken(APP_KEY, APP_SECRET, REFRESH_TOKEN);

                var accessToken = context.Token.AccessToken;

                var refreshToken = context.Token.RefreshToken;
                UpdateToken(accessToken, refreshToken);
            }
            catch (Exception ex)
            {
                ETong.Log.Sdk.LoggerMgr.GetLogger <Authorize>().ErrorExt("刷新token时返回异常:" + ex);
            }
        }