Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth access token expires #734

Open
1 task done
hackerb9 opened this issue Sep 19, 2023 · 8 comments
Open
1 task done

OAuth access token expires #734

hackerb9 opened this issue Sep 19, 2023 · 8 comments
Labels
Android Android related issue bug Something isn't working

Comments

@hackerb9
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When I start Spotube on my phone, it works at first, signing in with my Spotify credentials. I can do a search and see results. After some hours of not using it, when I open Spotube again, it shows where I left off in my search, but instead of results there is a blank area. If I try the search again, I see this error:

Screenshot_20230918-173332

In the logs, I see the same thing:

---------- ERROR ----------
OAuth authorization error (invalid_token): The access token expired.

I tried various things to get it to reconnect and the easiest workaround is to kill Spotube and restart it. It will automatically login and get a fresh OAuth token.

Expected Behavior

I expected Spotube to detect when the token expired and request a fresh one

Steps to reproduce

  1. Open Spotube
  2. Perform a search
  3. Do not play any music
  4. Switch to some other app or put down the phone for a few hours
  5. Switch back to Spotube
  6. See that it is not working

Operating System

Android OSP (GrapheneOS)

Spotube version

v3.1.1

Installation source

F-Droid (Android)

Additional information

I do not know if this problem occurs when playing music, but I presume not or other people would have noticed.

@hackerb9 hackerb9 added the bug Something isn't working label Sep 19, 2023
@KRTirtho
Copy link
Owner

KRTirtho commented Sep 19, 2023

What is it doing in the background for 6 hours in the first place. Usually, the android system should kill/suspend the app if it's in background and not doing anything

Also it can only refresh if it's in foreground (like playing music in background or user focused) ig thus it failed

@hackerb9
Copy link
Author

I do not know how to tell if an app is backgrounded and running or suspended. It was ignored for hours and non-functional when I used it again. Killing and restarting Spotube gets a fresh OAuth token, so I believe that is not what Android did. Is resuming from suspend supposed to renew the credentials?

I might have paused the music, if that matters. (Could the process have been kept alive by that music player that appears when I pull down from the top of the screen?)

@KRTirtho
Copy link
Owner

Yea I think I've make sure when app is resumed from the background, the credentials get renewed

@KRTirtho KRTirtho reopened this Sep 21, 2023
@KRTirtho KRTirtho moved this to Discussion in Spotube Board Sep 21, 2023
@KRTirtho KRTirtho added the Android Android related issue label Sep 21, 2023
@SrIzan10
Copy link

Hey!
It's also happening to me (Linux, Flatpak but that doesn't seem to matter).
Wouldn't it be easier to reissue an OAuth token every 3 or 4 hours so we can't get the error?
I usually keep my computer turned on, and having to restart the app kinda sucks.

@johnvanham
Copy link

johnvanham commented May 31, 2024

Hey! It's also happening to me (Linux, Flatpak but that doesn't seem to matter).

Same here, Linux (Fedora 40) installed via Flatpak. After a while, I haven't timed it, but it happens while I'm actively playing music, if I try and search or play from playlists or select another album or anything it just doesn't ever start playing and in the search I get the token expired message. So I think it needs to be refreshed regularly while the app is running? Restarting the app fixes it.

Awesome app though @KRTirtho, very impressive!

@peterweissbier
Copy link

still happening on android

@codekan
Copy link

codekan commented Jun 23, 2024

also still happening on windows - im currently listening to music but the search function doesn´t work with the same error:

OAuth authorization error (invalid_token): The access token expired.

i don´t know how long an oauth2 token is valid with spotifys implementation but i agree with @SrIzan10 on this one - it would be very useful to make the app request the token again but imo only when being brought back up in foreground as the app doesn´t need a new token while not being in foreground - listening to music somehow keeps working as i previously mentioned

@Porrumentzio
Copy link

Porrumentzio commented Aug 29, 2024

This is happening again on v3.8.0, downloaded from F-Droid

This is the new related issue: #1790

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Android related issue bug Something isn't working
Projects
Status: Discussion
Development

No branches or pull requests

7 participants