lastfm / lastfm-windows-desktop

Last.fm Desktop app for Windows (3.0)
GNU General Public License v3.0
10 stars 1 forks source link

Changing username during an active session causes the user to get stuck in 'offline' mode #69

Open Maddieman opened 6 years ago

Maddieman commented 6 years ago

This came up while we were testing changing usernames.

The issue here is that the user gets stuck in the (Offline) state, and can't log out or re-authenticate. The API returns Authentication Failed, but the client treats the error as if the user is offline and starts caching scrobbles.

Expected behaviour: User is automatically logged out and forced to reauthenticate.

offline

logging and settings.zip

VorTechS commented 6 years ago

Thanks for the files. I'll pick this up today, and make sure the application is fixed to behave the way it should!

VorTechS commented 6 years ago

@Maddieman Having loaded the settings file, and started the application - I'm getting an Invalid Session key and the application is throwing me back to the authentication loop.

I can't find anywhere on the website to change my username (only display name), so I can't test if this is an issue that occurs whilst the application is running.

Can someone point me at how to change my username and / or elevate my permissions so that I can do so? (A general google search suggests the changing of username is not supported)

Maddieman commented 6 years ago

Hi @VorTechS, I think Ben is away for the week, he asked me to file this one as we stumbled on this doing something else. I don't know how critical it is. Changing username is not a feature we officially support, but something we might be adding in the future, that's why we were testing against it to see how the client behaved. We can set up another test when he gets back, if needed.

We set this up by opening the application, authenticating, starting a playlist, and then changed the username after a few tracks had played.

It's weird though, on my computer it still treats the session as valid, even if I restart the application / my laptop (or at least, it doesn't prompt me to reauthenticate). Did I miss a file?

When I start it up again, the logging file reports:

10/25/2017 09:33:37 API Client Request  Performing Get API Request to Url: https://ws.audioscrobbler.com/2.0/, Method: user.getinfo, Parameters: &user=ChangeTest&api_key=7c58d2ae379ba37916c438c88455ec03&sk=D0q26BRr2n1YvdWe5a3DnyeKceI_82vN&format=json
10/25/2017 09:33:37 Scrobble Tracking   Checking Scrobble online status...
10/25/2017 09:33:37 API Client Request  Performing Get API Request to Url: https://ws.audioscrobbler.com/2.0/, Method: user.getinfo, Parameters: &user=ChangeTest&api_key=7c58d2ae379ba37916c438c88455ec03&sk=D0q26BRr2n1YvdWe5a3DnyeKceI_82vN&format=json
10/25/2017 09:33:37 API Client Response Response received was: StatusCode: 403, ReasonPhrase: 'Forbidden', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  Connection: keep-alive
  Access-Control-Allow-Methods: POST, GET, OPTIONS
  Access-Control-Allow-Origin: *
  Access-Control-Max-Age: 86400
  Date: Wed, 25 Oct 2017 09:33:37 GMT
  Server: openresty/1.9.7.3
  Content-Length: 97
  Content-Type: application/json
}
10/25/2017 09:33:37 API Client Response Response content was: {"error":4,"message":"Authentication Failed - You do not have permissions to access the service"}
10/25/2017 09:33:37 API Client Response Response received was: StatusCode: 403, ReasonPhrase: 'Forbidden', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  Connection: keep-alive
  Access-Control-Allow-Methods: POST, GET, OPTIONS
  Access-Control-Allow-Origin: *
  Access-Control-Max-Age: 86400
  Date: Wed, 25 Oct 2017 09:33:37 GMT
  Server: openresty/1.9.7.3
  Content-Length: 97
  Content-Type: application/json
}
10/25/2017 09:33:37 API Client Response Response content was: {"error":4,"message":"Authentication Failed - You do not have permissions to access the service"}
10/25/2017 09:33:37 Scrobble Tracking   Failed to check online status due to an error: LastFM.ApiClient.ResponseException: Exception of type 'LastFM.ApiClient.ResponseException' was thrown.
   at LastFM.ApiClient.HttpClient.<PerformRequest>d__19`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at LastFM.ApiClient.HttpClient.<SendRequest>d__21`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at LastFM.ApiClient.LastFMClient.<UnauthenticatedGet>d__29`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at LastFM.ApiClient.LastFMClient.<GetUserInfo>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at LastFM.Common.Factories.ScrobbleFactory.<CanScrobble>d__40.MoveNext()
10/25/2017 09:33:37 Scrobble Tracking   Caching 7 item(s) due to scrobbling being offline...