presencelight icon indicating copy to clipboard operation
presencelight copied to clipboard

Not loading Teams status

Open ColdFusion-007 opened this issue 2 years ago • 30 comments

As I have PresenceLight open, the Microsoft Team's status tab does not show my team status. It seems like the app does not log into my Microsoft Teams account. The loading pin wheel keep spinning. I've tried many different combinations of opening, closing teams or PresenceLight. I reinstalled PresenceLight but I can't seem to get the application to synchronize with my teams status. Prior to the last week or so, everything worked great. I love the PresenceLight app, Microsoft Teams, and I use a LIFX bulb to light up depending on my Teams status.

To reproduce this:

  1. I open Teams.
  2. I open PresenceLight.
  3. I can see the LIFX bulb is connected and configured.
  4. In the “Teams Status” menu/tab I can just see the spinning wheel continue to spin. Normally I do not see this loading page, or if I do it’s only for a second or two.
  5. It seems I can’t authenticate Teams with PresenceLight.

Attached is a screenshot of what I see.

Picture1

Application Type AppPackage Application Version 5.5.17 Install Location C:\Program Files\WindowsApps\37828IsaacLevin.197278F15330A_5.5.17.0_x64__zfcjmmeb3zeaa\PresenceLight
Install Date 6/17/2022 4:03 PM Runtime Version 6.0.5+70ae3df4a6f3c92fb6b315afc405edd10ff38579 Settings Path C:\Users\bhill\AppData\Local\Packages\37828IsaacLevin.197278F15330A_zfcjmmeb3zeaa\LocalState\settings.json

ColdFusion-007 avatar Jun 20 '22 19:06 ColdFusion-007

I've been getting the same issue too. Did the usual uninstall, reinstall, copy appsettings.json back in. Did not fix the issue. The logs do show the following image Error Occured getting Batch Content from Graph Api - GraphWrapper:GetBatchContent Line:106

Incidentally the chocolatey install also doesn't match the checksum. appv 5.5.17

Absoblogginlutely avatar Jun 30 '22 18:06 Absoblogginlutely

I'm running standalone version and added the AAD settings per issue #585 and issue still occurs

Absoblogginlutely avatar Jul 11 '22 14:07 Absoblogginlutely

I'm seeing the same problem here in the docker version as well as the desktop version. It works perfectly on the first run after installation/creation. After a restart it stops processing the Graph updates.

First run: [08:00:07 INF] PresenceLight Running in Teams Mode - /src/PresenceLight.Web/Worker:InteractWithLights Line: 157 [08:00:09 INF] Presence is Available - /src/PresenceLight.Web/Worker:GetPresence Line: 227 [08:00:14 INF] PresenceLight Running in Teams Mode - /src/PresenceLight.Web/Worker:InteractWithLights Line: 157 [08:00:14 INF] Presence is Available - /src/PresenceLight.Web/Worker:GetPresence Line: 227 [08:00:19 INF] PresenceLight Running in Teams Mode - /src/PresenceLight.Web/Worker:InteractWithLights Line: 157 [08:00:19 INF] Presence is Available - /src/PresenceLight.Web/Worker:GetPresence Line: 227 [08:00:24 INF] PresenceLight Running in Teams Mode - /src/PresenceLight.Web/Worker:InteractWithLights Line: 157 [08:00:24 INF] Presence is Available - /src/PresenceLight.Web/Worker:GetPresence Line: 227 [08:00:29 INF] PresenceLight Running in Teams Mode - /src/PresenceLight.Web/Worker:InteractWithLights Line: 157 [08:00:29 INF] Presence is Available - /src/PresenceLight.Web/Worker:GetPresence Line: 227

Subsequent runs: [05:10:42 WRN] Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed. [05:10:42 INF] User profile is available. Using '/root/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest. [05:10:42 INF] User is Authenticated, starting worker - /src/PresenceLight.Web/Worker:ExecuteAsync Line: 47 [05:10:42 INF] Now listening on: https://[::]:443 [05:10:42 INF] Now listening on: http://[::]:80 [05:10:42 INF] Application started. Press Ctrl+C to shut down. [05:10:42 INF] Hosting environment: Production [05:10:42 INF] Content root path: /app/ [05:10:44 INF] User is daffster - /src/PresenceLight.Web/Worker:GetUserInformation Line: 186 [05:10:45 INF] Presence is Available - /src/PresenceLight.Web/Worker:GetPresence Line: 227

daffster avatar Jul 12 '22 05:07 daffster

same here Any solution proposed?

Shrekmachine avatar Jul 14 '22 10:07 Shrekmachine

I just tried the latest version from the store and am able to login without issue.

image

Does the nightly work for any of you? You don't need to add your settings just valudate that you can login.

isaacrlevin avatar Jul 15 '22 16:07 isaacrlevin

I've got the same issue. I can only use the 'download' version and not the Window Store version as my company blocks everything..

This is the Json error I get:

{"Timestamp":"2022-07-15T20:06:28.6658971+02:00","Level":"Information","MessageTemplate":"Getting Graph Data: Profle, Image, Presence - GraphWrapper:GetBatchContent Line: 86","Properties":{"SourceContext":"PresenceLight.Core.GraphWrapper","LineNumber":86,"FilePath":"D:\\a\\presencelight\\presencelight\\src\\PresenceLight.Core\\GraphServices\\GraphWrapper.cs","MemberName":"GetBatchContent","Application":"PresenceLight"}}
{"Timestamp":"2022-07-15T20:06:38.5163859+02:00","Level":"Error","MessageTemplate":"Error Occured Getting Batch Content from Graph Api - GraphWrapper:GetBatchContent Line: 106","Exception":"Status Code: Forbidden\r\nMicrosoft.Graph.ServiceException: Code: Authorization_RequestDenied\r\nMessage: Insufficient privileges to complete the operation.\r\nInner error:\r\n\tAdditionalData:\r\n\tdate: 2022-07-15T18:06:38\r\n\trequest-id: 3569650f-c632-4fcc-abfe-fd87a0191669\r\n\tclient-request-id: 3569650f-c632-4fcc-abfe-fd87a0191669\r\n\r\n   at Microsoft.Graph.BatchResponseContent.ValidateSuccessfulResponse(HttpResponseMessage httpResponseMessage)\r\n   at Microsoft.Graph.BatchResponseContent.GetResponseByIdAsync[T](String requestId)\r\n   at PresenceLight.Core.GraphWrapper.GetBatchContent(CancellationToken token) in D:\\a\\presencelight\\presencelight\\src\\PresenceLight.Core\\GraphServices\\GraphWrapper.cs:line 99","Properties":{"SourceContext":"PresenceLight.Core.GraphWrapper","LineNumber":106,"FilePath":"D:\\a\\presencelight\\presencelight\\src\\PresenceLight.Core\\GraphServices\\GraphWrapper.cs","MemberName":"GetBatchContent","Application":"PresenceLight"}}
{"Timestamp":"2022-07-15T20:06:40.5644146+02:00","Level":"Information","MessageTemplate":"Getting Graph Data: Profle, Image, Presence - GraphWrapper:GetBatchContent Line: 86","Properties":{"SourceContext":"PresenceLight.Core.GraphWrapper","LineNumber":86,"FilePath":"D:\\a\\presencelight\\presencelight\\src\\PresenceLight.Core\\GraphServices\\GraphWrapper.cs","MemberName":"GetBatchContent","Application":"PresenceLight"}}
{"Timestamp":"2022-07-15T20:06:40.6751155+02:00","Level":"Error","MessageTemplate":"Error Occured Getting Batch Content from Graph Api - GraphWrapper:GetBatchContent Line: 106","Exception":"Status Code: Forbidden\r\nMicrosoft.Graph.ServiceException: Code: Authorization_RequestDenied\r\nMessage: Insufficient privileges to complete the operation.\r\nInner error:\r\n\tAdditionalData:\r\n\tdate: 2022-07-15T18:06:40\r\n\trequest-id: 13ad8fcf-4e18-49cd-8c05-1ccbe4df7031\r\n\tclient-request-id: 13ad8fcf-4e18-49cd-8c05-1ccbe4df7031\r\n\r\n   at Microsoft.Graph.BatchResponseContent.ValidateSuccessfulResponse(HttpResponseMessage httpResponseMessage)\r\n   at Microsoft.Graph.BatchResponseContent.GetResponseByIdAsync[T](String requestId)\r\n   at PresenceLight.Core.GraphWrapper.GetBatchContent(CancellationToken token) in D:\\a\\presencelight\\presencelight\\src\\PresenceLight.Core\\GraphServices\\GraphWrapper.cs:line 99","Properties":{"SourceContext":"PresenceLight.Core.GraphWrapper","LineNumber":106,"FilePath":"D:\\a\\presencelight\\presencelight\\src\\PresenceLight.Core\\GraphServices\\GraphWrapper.cs","MemberName":"GetBatchContent","Application":"PresenceLight"}}

It does not work on my Work laptop, it does work on my personal dekstop (both "Desktop v5.5.17" and nightly from Windows Store).

I've tried debugging, starting the PresenceLight project, it does run the XAML app, but clicking on the "SIGN IN" button doesn't do anything.

This exception the pops up:

Microsoft.Identity.Client.MsalClientException
  HResult=0x80131500
  Message=No ClientId was specified. 
  Source=Microsoft.Identity.Client
  StackTrace:
   at Microsoft.Identity.Client.AbstractApplicationBuilder`1.Validate()
   at Microsoft.Identity.Client.PublicClientApplicationBuilder.Validate()
   at Microsoft.Identity.Client.PublicClientApplicationBuilder.Build()
   at PresenceLight.Graph.GraphService.CreateAuthorizationProvider() in C:\Users\xx\source\personal\presencelight\src\DesktopClient\PresenceLight\Services\Graph\GraphService.cs:line 37

Ahh, looks like there is a lost settings.json in the release, but it uses appsettings.json. If I copy a working AADSettings to it I get this exception:

Microsoft.Graph.ServiceException
  HResult=0x80131500
  Message=Code: Authorization_RequestDenied
Message: Insufficient privileges to complete the operation.
Inner error:
	AdditionalData:
	date: 2022-07-15T18:31:07
	request-id: 66fc98bd-9598-4e60-96f5-d0811a61063a
	client-request-id: 66fc98bd-9598-4e60-96f5-d0811a61063a

  Source=Microsoft.Graph.Core
  StackTrace:
   at Microsoft.Graph.BatchResponseContent.<ValidateSuccessfulResponse>d__15.MoveNext()
   at Microsoft.Graph.BatchResponseContent.<GetResponseByIdAsync>d__13`1.MoveNext()
   at PresenceLight.Core.GraphWrapper.<GetBatchContent>d__13.MoveNext() in C:\Users\x\source\personal\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs:line 99

  This exception was originally thrown at this call stack:
    [External Code]
    PresenceLight.Core.GraphWrapper.GetBatchContent(System.Threading.CancellationToken) in GraphWrapper.cs

This is the corresponding code (failing on/at the last line):

IUserRequest userRequest = _graphServiceClient.Me.Request();
IPresenceRequest presenceRequest = _graphServiceClient.Me.Presence.Request();

BatchRequestContent batchRequestContent = new BatchRequestContent();

var userRequestId = batchRequestContent.AddBatchRequestStep(userRequest);
var presenceRequestId = batchRequestContent.AddBatchRequestStep(presenceRequest);

BatchResponseContent returnedResponse = await _graphServiceClient.Batch.Request().PostAsync(batchRequestContent, token).ConfigureAwait(true);

User user = await returnedResponse.GetResponseByIdAsync<User>(userRequestId).ConfigureAwait(true);

If I split these request:

IUserRequest userRequest1 = _graphServiceClient.Me.Request();
User user1 = await userRequest1.GetAsync(token).ConfigureAwait(true);

I get:

Microsoft.Graph.ServiceException
  HResult=0x80131500
  Message=Code: Authorization_RequestDenied
Message: Insufficient privileges to complete the operation.
Inner error:
	AdditionalData:
	date: 2022-07-15T18:38:23
	request-id: 1e69272f-1da4-4e7b-822e-6ac220a92ea5
	client-request-id: 1e69272f-1da4-4e7b-822e-6ac220a92ea5
ClientRequestId: 1e69272f-1da4-4e7b-822e-6ac220a92ea5

  Source=Microsoft.Graph.Core
  StackTrace:
   at Microsoft.Graph.HttpProvider.<SendAsync>d__18.MoveNext()
   at Microsoft.Graph.BaseRequest.<SendRequestAsync>d__40.MoveNext()
   at Microsoft.Graph.BaseRequest.<SendAsync>d__34`1.MoveNext()
   at Microsoft.Graph.UserRequest.<GetAsync>d__5.MoveNext()
   at PresenceLight.Core.GraphWrapper.<GetBatchContent>d__13.MoveNext() in C:\Users\x\source\personal\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs:line 98

  This exception was originally thrown at this call stack:
    [External Code]
    PresenceLight.Core.GraphWrapper.GetBatchContent(System.Threading.CancellationToken) in GraphWrapper.cs

And:

IPresenceRequest presenceRequest1 = _graphServiceClient.Me.Presence.Request();
Presence presence1 = await presenceRequest1.GetAsync(token).ConfigureAwait(true);

Gets:

Microsoft.Graph.ServiceException
  HResult=0x80131500
  Message=Code: Forbidden
Inner error:
	AdditionalData:
	request-id: 4f7085d7-2267-4971-b00b-943a38028f3d
	date: 2022-07-15T18:39:28
	client-request-id: 4f7085d7-2267-4971-b00b-943a38028f3d
ClientRequestId: 4f7085d7-2267-4971-b00b-943a38028f3d

  Source=Microsoft.Graph.Core
  StackTrace:
   at Microsoft.Graph.HttpProvider.<SendAsync>d__18.MoveNext()
   at Microsoft.Graph.BaseRequest.<SendRequestAsync>d__40.MoveNext()
   at Microsoft.Graph.BaseRequest.<SendAsync>d__34`1.MoveNext()
   at Microsoft.Graph.PresenceRequest.<GetAsync>d__5.MoveNext()
   at PresenceLight.Core.GraphWrapper.<GetBatchContent>d__13.MoveNext() in C:\Users\x\source\personal\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs:line 101

  This exception was originally thrown at this call stack:
    [External Code]
    PresenceLight.Core.GraphWrapper.GetBatchContent(System.Threading.CancellationToken) in GraphWrapper.cs

KoalaBear84 avatar Jul 15 '22 18:07 KoalaBear84

awesome, thanks for supporting this with such details

Shrekmachine avatar Jul 15 '22 18:07 Shrekmachine

I also like to get detailed error reports 😂

If I can help with testing anything, let me know. I really don't understand why it works on my own desktop, and not on my work laptop. It's both on the exact same (work) account, on the same internet. I do have to mention I do not have Admin rights by default on my work laptop.

OK, to rule the possible admin rights out I also tested it while running Visual Studio with admin rights, same result.

Desktop: Windows 10 Pro 21H2 19044.1766 Laptop: Windows 10 Enterprise 21H2 19044.1766

KoalaBear84 avatar Jul 15 '22 18:07 KoalaBear84

here it is not working, having full rights on WIN 11-. But I did not test the nightly yet. I use the MS Store version

Shrekmachine avatar Jul 15 '22 18:07 Shrekmachine

@KoalaBear84 thanks for this, it is really helpful. I wonder if your work PC has some group policies that are blocking things. Can you please look at Fiddler traces of both calls and let me know if there is anything different?

isaacrlevin avatar Jul 15 '22 19:07 isaacrlevin

I've tried, but don't succeed. I guess it now gives an error because of the an SSL error, because of Fiddler's not trusted certificate. Didn't find a way to disable it for GraphServiceClient

Microsoft.Graph.ServiceException
  HResult=0x80131500
  Message=Code: generalException
Message: An error occurred sending the request.

  Source=Microsoft.Graph.Core
  StackTrace:
   at Microsoft.Graph.HttpProvider.<SendRequestAsync>d__19.MoveNext()
   at Microsoft.Graph.HttpProvider.<SendAsync>d__18.MoveNext()
   at Microsoft.Graph.BaseRequest.<SendRequestAsync>d__40.MoveNext()
   at Microsoft.Graph.BaseRequest.<SendAsync>d__34`1.MoveNext()
   at Microsoft.Graph.UserRequest.<GetAsync>d__5.MoveNext()
   at PresenceLight.Core.GraphWrapper.<GetBatchContent>d__13.MoveNext() in C:\Users\x\source\personal\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs:line 92

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
HttpRequestException: The SSL connection could not be established, see inner exception.

Inner Exception 2:
IOException:  Received an unexpected EOF or 0 bytes from the transport stream.

KoalaBear84 avatar Jul 15 '22 21:07 KoalaBear84

Hmm. I've added an 'interceptor', forked, commited, restored the code on work laptop, got exceptions because the client id is empty, copied from desktop, and it worked..

Here is the fork, maybe come in handy. https://github.com/KoalaBear84/presencelight

Maybe the code is not checking if the AADSettings.ClientId is empty? I don't know how the token thing works, so it's easy to check on your side. Clear the ClientId and run it?

KoalaBear84 avatar Jul 15 '22 22:07 KoalaBear84

Not really following. Are you saying the deployed app the ClientId is blank?

isaacrlevin avatar Jul 20 '22 18:07 isaacrlevin

I got the 5.5.18 standalone tonight from chocolatey. Running as admin or normal user on Windows 11. I now get the following errors (a couple more than previously. Note that I get the same issue with the Nightly build too

{"Timestamp":"2022-07-20T20:45:31.2138895-04:00","Level":"Error","MessageTemplate":"Error Occured Getting Batch Content from Graph Api - GraphWrapper:GetBatchContent Line: 106","Exception":"Status Code: 0\r\nMicrosoft.Graph.ServiceException: Code: generalException\r\nMessage: An error occurred sending the request.\r\n\r\n ---> Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: Key not valid for use in specified state.\r\n at System.Security.Cryptography.ProtectedData.ProtectOrUnprotect(Byte[] inputData, Byte[] optionalEntropy, DataProtectionScope scope, Boolean protect)\r\n at PresenceLight.Graph.TokenCacheHelper.BeforeAccessNotification(TokenCacheNotificationArgs args) in D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\Services\Graph\TokenCacheHelper.cs:line 35\r\n at Microsoft.Identity.Client.TokenCache.Microsoft.Identity.Client.ITokenCacheInternal.OnBeforeAccessAsync(TokenCacheNotificationArgs args)\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.RefreshCacheForReadOperationsAsync()\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.RefreshCacheForReadOperationsAsync()\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.GetAccountsAsync()\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsInternalAsync(ApiIds apiId, String homeAccountIdFilter, CancellationToken cancellationToken)\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsAsync(CancellationToken cancellationToken)\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsAsync()\r\n at PresenceLight.Graph.WPFAuthorizationProvider.AuthenticateRequestAsync(HttpRequestMessage request) in D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\Services\Graph\WPFAuthorizationProvider.cs:line 57\r\n at Microsoft.Graph.AuthenticationHandler.SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)\r\n at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n --- End of inner exception stack trace ---\r\n at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)\r\n at Microsoft.Graph.Core.Requests.BatchRequest.PostAsync(BatchRequestContent batchRequestContent, CancellationToken cancellationToken)\r\n at PresenceLight.Core.GraphWrapper.GetBatchContent(CancellationToken token) in D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs:line 109","Properties":{"SourceContext":"PresenceLight.Core.GraphWrapper","LineNumber":106,"FilePath":"D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs","MemberName":"GetBatchContent","Application":"PresenceLight"}} {"Timestamp":"2022-07-20T20:45:33.2304832-04:00","Level":"Information","MessageTemplate":"Getting Graph Data: Profle, Image, Presence - GraphWrapper:GetBatchContent Line: 86","Properties":{"SourceContext":"PresenceLight.Core.GraphWrapper","LineNumber":86,"FilePath":"D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs","MemberName":"GetBatchContent","Application":"PresenceLight"}} {"Timestamp":"2022-07-20T20:45:33.2791331-04:00","Level":"Error","MessageTemplate":"Error Occured Getting Batch Content from Graph Api - GraphWrapper:GetBatchContent Line: 106","Exception":"Status Code: 0\r\nMicrosoft.Graph.ServiceException: Code: generalException\r\nMessage: An error occurred sending the request.\r\n\r\n ---> Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: Key not valid for use in specified state.\r\n at System.Security.Cryptography.ProtectedData.ProtectOrUnprotect(Byte[] inputData, Byte[] optionalEntropy, DataProtectionScope scope, Boolean protect)\r\n at PresenceLight.Graph.TokenCacheHelper.BeforeAccessNotification(TokenCacheNotificationArgs args) in D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\Services\Graph\TokenCacheHelper.cs:line 35\r\n at Microsoft.Identity.Client.TokenCache.Microsoft.Identity.Client.ITokenCacheInternal.OnBeforeAccessAsync(TokenCacheNotificationArgs args)\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.RefreshCacheForReadOperationsAsync()\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.RefreshCacheForReadOperationsAsync()\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.GetAccountsAsync()\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsInternalAsync(ApiIds apiId, String homeAccountIdFilter, CancellationToken cancellationToken)\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsAsync(CancellationToken cancellationToken)\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsAsync()\r\n at PresenceLight.Graph.WPFAuthorizationProvider.AuthenticateRequestAsync(HttpRequestMessage request) in D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\Services\Graph\WPFAuthorizationProvider.cs:line 57\r\n at Microsoft.Graph.AuthenticationHandler.SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)\r\n at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n --- End of inner exception stack trace ---\r\n at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)\r\n at Microsoft.Graph.Core.Requests.BatchRequest.PostAsync(BatchRequestContent batchRequestContent, CancellationToken cancellationToken)\r\n at PresenceLight.Core.GraphWrapper.GetBatchContent(CancellationToken token) in D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs:line 109","Properties":{"SourceContext":"PresenceLight.Core.GraphWrapper","LineNumber":106,"FilePath":"D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs","MemberName":"GetBatchContent","Application":"PresenceLight"}} {"Timestamp":"2022-07-20T20:45:37.2866858-04:00","Level":"Information","MessageTemplate":"Getting Graph Data: Profle, Image, Presence - GraphWrapper:GetBatchContent Line: 86","Properties":{"SourceContext":"PresenceLight.Core.GraphWrapper","LineNumber":86,"FilePath":"D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs","MemberName":"GetBatchContent","Application":"PresenceLight"}} {"Timestamp":"2022-07-20T20:45:37.3288846-04:00","Level":"Error","MessageTemplate":"Error Occured Getting Batch Content from Graph Api - GraphWrapper:GetBatchContent Line: 106","Exception":"Status Code: 0\r\nMicrosoft.Graph.ServiceException: Code: generalException\r\nMessage: An error occurred sending the request.\r\n\r\n ---> Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: Key not valid for use in specified state.\r\n at System.Security.Cryptography.ProtectedData.ProtectOrUnprotect(Byte[] inputData, Byte[] optionalEntropy, DataProtectionScope scope, Boolean protect)\r\n at PresenceLight.Graph.TokenCacheHelper.BeforeAccessNotification(TokenCacheNotificationArgs args) in D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\Services\Graph\TokenCacheHelper.cs:line 35\r\n at Microsoft.Identity.Client.TokenCache.Microsoft.Identity.Client.ITokenCacheInternal.OnBeforeAccessAsync(TokenCacheNotificationArgs args)\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.RefreshCacheForReadOperationsAsync()\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.RefreshCacheForReadOperationsAsync()\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.GetAccountsAsync()\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsInternalAsync(ApiIds apiId, String homeAccountIdFilter, CancellationToken cancellationToken)\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsAsync(CancellationToken cancellationToken)\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsAsync()\r\n at PresenceLight.Graph.WPFAuthorizationProvider.AuthenticateRequestAsync(HttpRequestMessage request) in D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\Services\Graph\WPFAuthorizationProvider.cs:line 57\r\n at Microsoft.Graph.AuthenticationHandler.SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)\r\n at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n --- End of inner exception stack trace ---\r\n at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)\r\n at Microsoft.Graph.Core.Requests.BatchRequest.PostAsync(BatchRequestContent batchRequestContent, CancellationToken cancellationToken)\r\n at PresenceLight.Core.GraphWrapper.GetBatchContent(CancellationToken token) in D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs:line 109","Properties":{"SourceContext":"PresenceLight.Core.GraphWrapper","LineNumber":106,"FilePath":"D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs","MemberName":"GetBatchContent","Application":"PresenceLight"}} {"Timestamp":"2022-07-20T20:45:37.3322005-04:00","Level":"Error","MessageTemplate":"Error occured interacting with lights - MainWindow.xaml:InteractWithLights Line: 604","Exception":"Status Code: 0\r\nMicrosoft.Graph.ServiceException: Code: generalException\r\nMessage: An error occurred sending the request.\r\n\r\n ---> Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: Key not valid for use in specified state.\r\n at System.Security.Cryptography.ProtectedData.ProtectOrUnprotect(Byte[] inputData, Byte[] optionalEntropy, DataProtectionScope scope, Boolean protect)\r\n at PresenceLight.Graph.TokenCacheHelper.BeforeAccessNotification(TokenCacheNotificationArgs args) in D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\Services\Graph\TokenCacheHelper.cs:line 35\r\n at Microsoft.Identity.Client.TokenCache.Microsoft.Identity.Client.ITokenCacheInternal.OnBeforeAccessAsync(TokenCacheNotificationArgs args)\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.RefreshCacheForReadOperationsAsync()\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.RefreshCacheForReadOperationsAsync()\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.GetAccountsAsync()\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsInternalAsync(ApiIds apiId, String homeAccountIdFilter, CancellationToken cancellationToken)\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsAsync(CancellationToken cancellationToken)\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsAsync()\r\n at PresenceLight.Graph.WPFAuthorizationProvider.AuthenticateRequestAsync(HttpRequestMessage request) in D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\Services\Graph\WPFAuthorizationProvider.cs:line 57\r\n at Microsoft.Graph.AuthenticationHandler.SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)\r\n at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n --- End of inner exception stack trace ---\r\n at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)\r\n at Microsoft.Graph.Core.Requests.BatchRequest.PostAsync(BatchRequestContent batchRequestContent, CancellationToken cancellationToken)\r\n at PresenceLight.Core.GraphWrapper.GetBatchContent(CancellationToken token) in D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs:line 109\r\n at PresenceLight.Core.GraphWrapper.<>c__DisplayClass12_0.<<GetProfileAndPresence>b__0>d.MoveNext() in D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs:line 80\r\n--- End of stack trace from previous location ---\r\n at Polly.Retry.AsyncRetryEngine.ImplementationAsync[TResult](Func3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates1 shouldRetryResultPredicates, Func5 onRetryAsync, Int32 permittedRetryCount, IEnumerable1 sleepDurationsEnumerable, Func4 sleepDurationProvider, Boolean continueOnCapturedContext)\r\n at Polly.AsyncPolicy.ExecuteAsync[TResult](Func3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)\r\n at PresenceLight.Core.GraphWrapper.GetProfileAndPresence(CancellationToken token) in D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs:line 81\r\n at PresenceLight.Core.GraphServices.GetProfileAndPresenceHandler.Handle(GetProfileAndPresenceCommand command, CancellationToken cancellationToken) in D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GetProfileAndPresence\GetProfileAndPresenceHandler.cs:line 24\r\n at MediatR.Pipeline.RequestExceptionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestExceptionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestExceptionActionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestExceptionActionProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestPostProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at MediatR.Pipeline.RequestPreProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)\r\n at PresenceLight.MainWindow.InteractWithLights() in D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs:line 489","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":604,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"InteractWithLights","Application":"PresenceLight"}} {"Timestamp":"2022-07-20T20:45:37.3343682-04:00","Level":"Information","MessageTemplate":"Getting Graph Data: Profle, Image, Presence - GraphWrapper:GetBatchContent Line: 86","Properties":{"SourceContext":"PresenceLight.Core.GraphWrapper","LineNumber":86,"FilePath":"D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs","MemberName":"GetBatchContent","Application":"PresenceLight"}} {"Timestamp":"2022-07-20T20:45:37.3757099-04:00","Level":"Error","MessageTemplate":"Error Occured Getting Batch Content from Graph Api - GraphWrapper:GetBatchContent Line: 106","Exception":"Status Code: 0\r\nMicrosoft.Graph.ServiceException: Code: generalException\r\nMessage: An error occurred sending the request.\r\n\r\n ---> Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: Key not valid for use in specified state.\r\n at System.Security.Cryptography.ProtectedData.ProtectOrUnprotect(Byte[] inputData, Byte[] optionalEntropy, DataProtectionScope scope, Boolean protect)\r\n at PresenceLight.Graph.TokenCacheHelper.BeforeAccessNotification(TokenCacheNotificationArgs args) in D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\Services\Graph\TokenCacheHelper.cs:line 35\r\n at Microsoft.Identity.Client.TokenCache.Microsoft.Identity.Client.ITokenCacheInternal.OnBeforeAccessAsync(TokenCacheNotificationArgs args)\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.RefreshCacheForReadOperationsAsync()\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.RefreshCacheForReadOperationsAsync()\r\n at Microsoft.Identity.Client.Cache.CacheSessionManager.GetAccountsAsync()\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsInternalAsync(ApiIds apiId, String homeAccountIdFilter, CancellationToken cancellationToken)\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsAsync(CancellationToken cancellationToken)\r\n at Microsoft.Identity.Client.ClientApplicationBase.GetAccountsAsync()\r\n at PresenceLight.Graph.WPFAuthorizationProvider.AuthenticateRequestAsync(HttpRequestMessage request) in D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\Services\Graph\WPFAuthorizationProvider.cs:line 57\r\n at Microsoft.Graph.AuthenticationHandler.SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)\r\n at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n --- End of inner exception stack trace ---\r\n at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)\r\n at Microsoft.Graph.Core.Requests.BatchRequest.PostAsync(BatchRequestContent batchRequestContent, CancellationToken cancellationToken)\r\n at PresenceLight.Core.GraphWrapper.GetBatchContent(CancellationToken token) in D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs:line 109","Properties":{"SourceContext":"PresenceLight.Core.GraphWrapper","LineNumber":106,"FilePath":"D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs","MemberName":"GetBatchContent","Application":"PresenceLight"}}

Absoblogginlutely avatar Jul 21 '22 00:07 Absoblogginlutely

Hrm... I would remove all instances of PresenceLight and restart and install the choco version again.

isaacrlevin avatar Jul 21 '22 04:07 isaacrlevin

Update, how I got the version from the WinStore (5.5.17) back to work:

  1. Save settings.json
  2. Uninstall PL via standard routine
  3. reinstall from WinStore
  4. Test run (worked fine, obviously w/o my config
  5. stopped PL
  6. copied settings.json (step 1) back to PL folder
  7. 2nd run, now with all settings incl. Philips Hue --> all fine On a side note: the bug with the empty screen is still present, who have to resize the settings window to populate the controls

Shrekmachine avatar Jul 21 '22 07:07 Shrekmachine

Removed presencelight nightly, chocolatey version. Verified directory with settings was removed. Reinstalled with Chocolatey. (version 5.5.18). Runtime version is 6.0.8 Opened application. Same issue occurs. White screen with spinning logo. Live logs show same issue as previously documented. I didn't get prompted to sign in at all interestingly. I assume it's using SSO.

AHelsby avatar Jul 21 '22 14:07 AHelsby

@AHelsby I assume this is a work device. Are you able to try a personal one? I just tried on 3 different machines and was not able to repro

isaacrlevin avatar Jul 21 '22 15:07 isaacrlevin

Thanks @isaacrlevin - I was able to install on my work laptop (Windows 10) with no issues and was able to pull back my Teams status. On that laptop after install I was taken to the Office365Login page to obtain authentication and then able to get in. On my work Windows11 desktop I was not taken to the Office365Login page after reinstalling. Confirmed my appdata directory c:\users\username\appdata\roaming\presencelight is removed after the install. Any registry entries I need to clear out before installing? I didn't find much with a search for Presencelight I did delete a couple of entries from the windowsapp registry AV in case it's of interest is Webroot with huntress and Opendns and Pi-Hole, web browsers have adblock plus installed. Both machines have all 3 protections included. If theres any additional debugging I can do, then please let me know

Update: I deleted the app from enterprise applications in AD. Launched the app - still no signin attempted. Removed chocolatey install. Installed nightly build. Same issue occurred Not sure why the app is not attempting/failing to sign in.

AHelsby avatar Jul 21 '22 16:07 AHelsby

So you aren't getting prompted to login on some machines? That is odd and I really can't help in that case.

isaacrlevin avatar Jul 25 '22 23:07 isaacrlevin

I do have this issue also. That's why I manually copied the token to the other computer. So it's a more common issue.

That was what I was trying to mention here

KoalaBear84 avatar Jul 26 '22 08:07 KoalaBear84

Which/what is the token you copied @KoalaBear84? I zipped up my chocolatey install from my working laptop and copied over to my chocolatey install on my nonworking desktop today. Opened app, same issue occurred. On the nonworking desktop I went into appsettings.json and set clientid to "" and restarted the app Now the application asks me to signin but clicking the signin button doesn't open a browser to authenticate. The live logs is now blank and not showing anything. Very odd.

Absoblogginlutely avatar Jul 26 '22 12:07 Absoblogginlutely

The app won't work if Client ID is blank. Frankly if it works on one machine but not another, I would look into what the differences are between those machines

isaacrlevin avatar Jul 26 '22 14:07 isaacrlevin

Yes, I think I copied the AADSettings.ClientId over, but I see it was already included in the ZIP. So I'm not sure. Maybe I was confused by the lost "settings.json" which isn't used (If I'm correct).

It is empty here, but it might be filled in a build step or so. https://github.com/isaacrlevin/presencelight/blob/main/src/DesktopClient/PresenceLight/appsettings.json

KoalaBear84 avatar Jul 27 '22 12:07 KoalaBear84

Yes I add it in a build step. If it works on one machine and not another, it probably isn't a settings issue

isaacrlevin avatar Jul 27 '22 12:07 isaacrlevin

Stopped working on my laptop this week too :-( I did a bit more digging last night and got it to work again (steps below that lose the original config)

First I closed the app. choco uninstall Presencelight Deleted c:\users%username%\appdata\local\PresenceLight Deleted %appdata%\PresenceLight (C:\Users\username\AppData\Roaming\PresenceLight) Reinstalled app. Received login prompt. Entered credentials. Received admin consent validation. Accepted Admin Consent validation. Restarted Presencelight. Logged in. I did have to go through and setup my Hue again - I tried copy/pasting from a saved settings file but that did not work for me. Light is now synching correctly again.

Absoblogginlutely avatar Aug 09 '22 12:08 Absoblogginlutely

also, stopped working for me a few days ago, it eventually logs in but upon restart, just get loading circle on the availability screen, and here's the live logs

image

@Absoblogginlutely, is this the ultimate fix? Anyway I can keep settings because I have API links and rather not have to redo all those links!

EDIT: by the way, my computer is Windows 10 computer with no work restrictions (I'm the admin), and using the Windows Store App. All was working well (for months) up until 2 days ago

Anto79-ops avatar Aug 10 '22 16:08 Anto79-ops

Hi, just an update, here's 2 hours after starting other computer, it works again (without any intervention)

live logs:

image

and status page also good to go:

image

notice in the logs are a bit different, errors seem to be more benign (no line 106 error).

Is this a MS server issue, perhaps?

Anto79-ops avatar Aug 10 '22 19:08 Anto79-ops

MS was having issues earlier today due to some snort detection rules - most noticable if you were behind a meraki firewall so it could have been that for you. Your screen with the getbatchcontent errors looked very similar to what I was getting. The odd thing is that when it wasn't working for me I was never asked to login on the machine. In the past I was able to keep the configuration by just copying the settings file back in as noted by shrekmachine earlier. Just for some reason it wouldn't work for me yesterday.

However, today my light has been lighting up all day successfully - very helpful - thanks!

Absoblogginlutely avatar Aug 10 '22 21:08 Absoblogginlutely

this morning, I had no issues. Looks like a MS issue. thanks all!

Anto79-ops avatar Aug 11 '22 14:08 Anto79-ops