diff --git a/src/Lib/SignIn.Uwp/AuthorizeProvider/AuthorizeProvider.Extension.cs b/src/Lib/SignIn.Uwp/AuthorizeProvider/AuthorizeProvider.Extension.cs index 2d4a310b6..7661bf193 100644 --- a/src/Lib/SignIn.Uwp/AuthorizeProvider/AuthorizeProvider.Extension.cs +++ b/src/Lib/SignIn.Uwp/AuthorizeProvider/AuthorizeProvider.Extension.cs @@ -2,8 +2,6 @@ using System; using System.Collections.Generic; -using System.Drawing.Imaging; -using System.IO; using System.Linq; using System.Net.Http; using System.Runtime.InteropServices.WindowsRuntime; @@ -241,7 +239,7 @@ internal async Task GetQRImageAsync() { Query.LocalId, _guid }, }; var httpProvider = Locator.Instance.GetService(); - var request = await httpProvider.GetRequestMessageAsync(HttpMethod.Post, Passport.QRCode, queryParameters); + var request = await httpProvider.GetRequestMessageAsync(HttpMethod.Post, Passport.QRCode, queryParameters, RequestClientType.Login); var response = await httpProvider.SendAsync(request); var result = await httpProvider.ParseAsync>(response); @@ -305,25 +303,19 @@ private async void OnQRTimerTickAsync(object sender, object e) { { Query.AuthCode, _internalQRAuthCode }, { Query.LocalId, _guid }, + { "guid", Guid.NewGuid().ToString() }, }; try { var httpProvider = Locator.Instance.GetService(); - var request = await httpProvider.GetRequestMessageAsync(HttpMethod.Post, Passport.QRCodeCheck, queryParameters); + var request = await httpProvider.GetRequestMessageAsync(HttpMethod.Post, Passport.QRCodeCheck, queryParameters, RequestClientType.Login); var response = await httpProvider.SendAsync(request, _qrPollCancellationTokenSource.Token); var result = await httpProvider.ParseAsync>(response); // 保存cookie SaveCookie(result.Data.CookieInfo); - - // 获取确认链接 - var confirmUrl = await GetCookieToAccessKeyConfirmUrlAsync(); - - // 获取新的访问令牌 - var accessKey = await GetAccessKeyAsync(confirmUrl); - result.Data.AccessToken = accessKey; - + SaveAuthorizeResult(result.Data); QRCodeStatusChanged?.Invoke(this, new Tuple(QRCodeStatus.Success, result.Data)); } catch (ServiceException se) @@ -336,7 +328,7 @@ private async void OnQRTimerTickAsync(object sender, object e) if (se.Error != null) { QRCodeStatus qrStatus = default; - if (se.Error.Code == 86039) + if (se.Error.Code == 86039 || se.Error.Code == 86090) { qrStatus = QRCodeStatus.NotConfirm; } diff --git a/src/Models/Models.App/Constants/ServiceConstants.cs b/src/Models/Models.App/Constants/ServiceConstants.cs index 1e7065c60..011540a94 100644 --- a/src/Models/Models.App/Constants/ServiceConstants.cs +++ b/src/Models/Models.App/Constants/ServiceConstants.cs @@ -44,8 +44,8 @@ public static class Keys public const string IOSSecret = "c2ed53a74eeefe3cf99fbd01d8c9c375"; public const string WebKey = "84956560bc028eb7"; public const string WebSecret = "94aba54af9065f71de72f5508f1cd42e"; - public const string LoginKey = "4409e2ce8ffd12b8"; - public const string LoginSecret = "59b43e04ad6965f34319062b478f83dd"; + public const string LoginKey = "27eb53fc9058f8c3"; + public const string LoginSecret = "c2ed53a74eeefe3cf99fbd01d8c9c375"; } public static class Query diff --git a/src/ViewModels/ViewModels.Uwp/Account/AccountViewModel/AccountViewModel.SignIn.cs b/src/ViewModels/ViewModels.Uwp/Account/AccountViewModel/AccountViewModel.SignIn.cs index b2a2b4493..ef6721e0d 100644 --- a/src/ViewModels/ViewModels.Uwp/Account/AccountViewModel/AccountViewModel.SignIn.cs +++ b/src/ViewModels/ViewModels.Uwp/Account/AccountViewModel/AccountViewModel.SignIn.cs @@ -28,6 +28,7 @@ private async Task InternalSignInAsync(bool isSlientOnly = false) if (isTokenValid) { isSuccess = true; + State = AuthorizeState.SignedIn; HandleLogged(); } else if (!isSlientOnly) @@ -62,6 +63,13 @@ await _dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async State = AuthorizeState.SignedIn; }); } + else + { + await _dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () => + { + await SignOutAsync(); + }); + } }); } }