// 自定义登录 public async Task <AuthState> SignInWithTicketAsync(string ticket) { if (string.IsNullOrEmpty(ticket)) { throw new CloudBaseException(CloudBaseExceptionCode.EMPTY_PARAM, "登录票据不能为空"); } string refreshToken = cache.GetStore(cache.RefreshTokenKey); Dictionary <string, dynamic> param = new Dictionary <string, dynamic>(); param.Add("ticket", ticket); param.Add("refresh_token", refreshToken); AuthResponse res = await this.core.Request.PostWithoutAuthAsync <AuthResponse>("auth.signInWithTicket", param); if (!string.IsNullOrEmpty(res.Code)) { throw new CloudBaseException(res.Code, res.Message); } if (!res.Data.ContainsKey("refresh_token")) { throw new CloudBaseException(CloudBaseExceptionCode.AUTH_FAILED, "自定义登录失败"); } string newRefreshToken = (string)res.Data["refresh_token"]; await this.SetRefreshTokenAsync(newRefreshToken); await this.RefreshAccessTokenAsync(); cache.SetStore(cache.LoginTypeKey, AuthType.CUSTOM); string accessToken = cache.GetStore(cache.AccessTokenKey); AuthState authState = new AuthState(AuthType.CUSTOM, newRefreshToken, accessToken); return(authState); }