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

Token Not Refreshing Automatically #232

Open
Sirpotatos opened this issue Nov 26, 2022 · 9 comments
Open

Token Not Refreshing Automatically #232

Sirpotatos opened this issue Nov 26, 2022 · 9 comments

Comments

@Sirpotatos
Copy link

Firefly III Server Version:
5.7.14
Firefly III Mobile Version:
5.0.7
Android Version:
13
Device Information:

  • BRAND: Google
  • MODEL: Pixel 4a 5g

Expected Behavior

Token should refresh automatically every 24 hours, and even if it didn't the token shouldn't expire until the date listed on the same screen.

Current Behavior

After a few weeks or so the token expires and I receive the "unauthenticated" popup when trying to add a transaction. The token must be manually refreshed from the settings -> accounts page. The app is not automatically refreshing every 24 hours, even though the "Refresh Token in Interval" is set to On and the "Refresh Token Interval" is set to "24 hours(Recommended)".

@emansih
Copy link
Owner

emansih commented Nov 27, 2022

I am using Google's Work Manager library. Scheduling tasks on Android is finicky as Android provides very little guarantee that an app can run it's scheduled tasks. having said that, this is a pixel, I wouldn't expect this to be happening. I will investigate it when I have the time

@Sirpotatos
Copy link
Author

To update this, I had to manually refresh again yesterday, so it's looks like the token only lasted 2 weeks.

@emansih
Copy link
Owner

emansih commented Dec 12, 2022

Hello. I will take a look at this issue over Christmas(in 2 weeks time). Unfortunately it will be in 2 weeks time.

Are you using PAT or OAuth?

@Sirpotatos
Copy link
Author

Using OAuth.

@emansih
Copy link
Owner

emansih commented Jan 13, 2023

Screenshot

Hello, I have tested the feature and it works. There are a few requirements before refresh token worker run

  1. Your device is charging
  2. Connected to a network
  3. The battery is not low

@Sirpotatos
Copy link
Author

It would really be best if these requirements were toggles, so that they don't all have to be met in order to refresh, as I don't charge my phone every single night.
Additionally, it doesn't really make sense still what is going on, as the Token says it will expire in 2025? So why is a 24 hour refresh necessary and why does my token expire every few weeks?
Also, when does the refresh happen? Only at a specific time? How many times in a day does it re-attempt? Is it possible that the token is trying to refresh during the day when my phone is not charging and then it just doesn't try again until 24 hours passes again?

@perezalvarezhi
Copy link

Hi guys any luck eith this one? im having the same problem. I plug my device every night (a pixel 6 pro) but It doesnt look like it is refreshing the token.(logged in with oAuth)

@Sirpotatos
Copy link
Author

Hi guys any luck eith this one? im having the same problem. I plug my device every night (a pixel 6 pro) but It doesnt look like it is refreshing the token.(logged in with oAuth)

Well I'm glad I'm not the only one! Your issue sounds the same as mine. The dev never answered my questions above, but my hunch is that the app trys at the same time everyday to refresh then gives up (mine says token will expire 14 Aug @ noon) and since my phone is never charging at noon, if it's only checking at that time I'll never get a refresh before 14 Aug.

What time does your token expire at?

@perezalvarezhi
Copy link

Hi guys any luck eith this one? im having the same problem. I plug my device every night (a pixel 6 pro) but It doesnt look like it is refreshing the token.(logged in with oAuth)

Well I'm glad I'm not the only one! Your issue sounds the same as mine. The dev never answered my questions above, but my hunch is that the app trys at the same time everyday to refresh then gives up (mine says token will expire 14 Aug @ noon) and since my phone is never charging at noon, if it's only checking at that time I'll never get a refresh before 14 Aug.

What time does your token expire at?

I didnt take note of the refresh time since I just fixed it by manually refreshing it in options>Accounts>Refresh Token. The time right now is 8:25 am.

The refresh token in Interval function was not activated in my app and I just activated it, ill come back to you in case in 2 weeks this auto refresh doesnt work for me.

Just to make sure my app version is also 5.07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants