private async void AccountManager_AccessTokenRequestedAsync(ConnectedDevicesAccountManager sender, ConnectedDevicesAccessTokenRequestedEventArgs args) { Logger.Instance.LogMessage($"Token requested by platform for {args.Request.Account.Id} and {string.Join(" ", args.Request.Scopes)}"); var account = m_accounts.Find((x) => x.EqualsTo(args.Request.Account)); if (account != null) { try { var accessToken = await account.GetAccessTokenAsync(args.Request.Scopes); Logger.Instance.LogMessage($"Token : {accessToken}"); args.Request.CompleteWithAccessToken(accessToken); } catch (Exception ex) { Logger.Instance.LogMessage($"Token request failed: {ex.Message}"); args.Request.CompleteWithErrorMessage(ex.Message); } } }
private void AccountManager_AccessTokenInvalidated(ConnectedDevicesAccountManager sender, ConnectedDevicesAccessTokenInvalidatedEventArgs args) { Logger.Instance.LogMessage($"Token Invalidated. AccountId: {args.Account.Id}, AccountType: {args.Account.Id}, scopes: {string.Join(" ", args.Scopes)}"); }