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

[BUG] OAuth Access token not preserved on macos #811

Closed
tychobrailleur opened this issue Nov 29, 2020 · 11 comments · Fixed by #822
Closed

[BUG] OAuth Access token not preserved on macos #811

tychobrailleur opened this issue Nov 29, 2020 · 11 comments · Fixed by #822

Comments

@tychobrailleur
Copy link
Collaborator

Describe the bug
When restarting HO on Macos, some users are prompted with the OAuth challenge, which indicates that the OAuth access token doesn't seem to be stored in the USERCONFIGURATION table.

To Reproduce
Steps to reproduce the behavior:

  1. Start HO
  2. Download details from Hattrick, connect using OAuth
  3. Shut down HO
  4. Start HO again
  5. Try downloading details again from Hattrick: OAuth challenge is prompted again.

Screenshots
N/A

Platform information:

  • OS: macOS
  • Version: 4.1.3310

Additional context
N/A

@tychobrailleur
Copy link
Collaborator Author

Screenshot 2020-11-29 at 14 27 52

@tychobrailleur
Copy link
Collaborator Author

That is quite a strange one – I thought that using the closing button in the titlebar was solving the problem, but it seems to be happening randomly, as if there was some sort of race condition between windowClosed and windowClosing?

@dtslvr
Copy link

dtslvr commented Dec 5, 2020

I don't know if it's related, but besides adding the access token every time I also have to set the path of my .hrf files.

@akasolace
Copy link
Collaborator

@tychobrailleur have you had time to look at this one ?

@tychobrailleur
Copy link
Collaborator Author

I don't know if it's related, but besides adding the access token every time I also have to set the path of my .hrf files.

Thanks @dtslvr, it is related: user preferences (incl. OAuth access token) don't get saved when HO exits. Arguably we could save it right after we have retrieved from HT.

@tychobrailleur have you had time to look at this one ?

I haven't, but I am looking at it right now, hopefully I should have a fix soon.
As an aside, I am experiencing an NPE with master due Youth changes:

java.lang.NullPointerException
	at core.file.xml.ConvertXml2Hrf.createHrf(ConvertXml2Hrf.java:148)
	at core.net.OnlineWorker.getHrf(OnlineWorker.java:80)
	at core.net.DownloadDialog.startDownload(DownloadDialog.java:271)
	at core.net.DownloadDialog.actionPerformed(DownloadDialog.java:92)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)

and line 148 in ConvertXml2Hrf:

		int youthteamId = HOVerwaltung.instance().getModel().getBasics().getYouthTeamId();

@tychobrailleur
Copy link
Collaborator Author

That is quite a strange one – I thought that using the closing button in the titlebar was solving the problem, but it seems to be happening randomly, as if there was some sort of race condition between windowClosed and windowClosing?

I am convinced there is a race condition here, as this takes the form of a “heisenbug”: when adding logging statements to debug (or simply debugging), the problem disappears... What is unclear to me is whether something changed in HO or the JDK to cause this issue to emerge. Or if the problem was always there but somehow now appears due some changes.

@tychobrailleur
Copy link
Collaborator Author

I have created a PR with a fix that seems to work locally. Having not been able to track down the cause of this, I am not fully convinced this fixes the issue for good, it would be great to have other people try out this fix (this may be challenging due to some NPEs on master).

@wsbrenk
Copy link
Collaborator

wsbrenk commented Dec 5, 2020

@tychobrailleur great to see you back. Concerning youth NPE. Thanks for that. Will fix this immediately. I guess you don't have an academy, which is a big mistake;-)

More concerning this, in my "youth-ticket" #367

@cmeury
Copy link

cmeury commented Aug 3, 2021

I still have this problem; version 4.1.3310.2 on MacOS 11.5. Also, preferences do not seem to get saved either. Should I open a new issue for this?

@wsbrenk
Copy link
Collaborator

wsbrenk commented Aug 25, 2021

@cmeury this fix is not part of the 4.1 release version. You could test if it is fixed with a new 5.0-DEV-version. But at your own risc. Please don't do it without backups of your database and program folders.

@cmeury
Copy link

cmeury commented Aug 26, 2021

Thanks @wsbrenk -- it seems to be resolved with 5.0.3730.0. I can close and re-open HO and it will not ask me for the token anymore.

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

Successfully merging a pull request may close this issue.

5 participants