Bug 491454

Summary: Unable to login ("Der Zugriffstoken ist ungültig" / "The access token is invalid")
Product: [Applications] Tokodon Reporter: Vincent Wilms <kde>
Component: generalAssignee: Unassigned bugs <unassigned-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: carl, josh
Priority: NOR    
Version First Reported In: 24.05.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 24.12
Sentry Crash Report:
Attachments: Tokodon Issue

Description Vincent Wilms 2024-08-08 20:48:29 UTC
Created attachment 172414 [details]
Tokodon Issue

SUMMARY
I cannot use Flatpak version of Tokodon anymore because it says "There was an issue logging into the server: Der Zugriffstoken ist ungültig" (= The access token is invalid).

It tells me to either "View Website" (which opens the website just fine in Firefox in a logged-in state), or to "Re-Attempt Log In" whereas a click on that button does nothing except for refreshing the page for a millisecond or so.

STEPS TO REPRODUCE
It is hard to provide reproduction steps as I don't know how to get into the "access token is invalid" state.

OBSERVED RESULT
I only see the page "Login Issue" and cannot move forward.

EXPECTED RESULT
Successful login.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: Kubuntu 24.04
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.13

ADDITIONAL INFORMATION

Here is the console output, in case it is important:
```
❯ flatpak run --branch=stable --arch=x86_64 --command=tokodon --file-forwarding org.kde.tokodon @@u %u @@
F: Not sharing "/usr/share/icons" with sandbox: Path "/usr" is reserved by Flatpak
Qt: Session management error: Could not open network socket
org.kde.tokodon.http: QVariant(int, 401) QUrl("https://social.linux.pizza/api/v1/accounts/verify_credentials")
qrc:/qt/qml/org/kde/tokodon/content/ui/LoginFlow/LoginIssuePage.qml:14:1: QML LoginIssuePage: Created graphical object was not placed in the graphics scene.
qrc:/qt/qml/org/kde/kirigamiaddons/formcard/FormTextDelegate.qml:83:9: QML ContentItemLoader: List didn't append all objects
qrc:/qt/qml/org/kde/tokodon/content/ui/LoginFlow/LoginIssuePage.qml:14:1: QML LoginIssuePage: Created graphical object was not placed in the graphics scene.
qrc:/qt/qml/org/kde/kirigamiaddons/formcard/FormTextDelegate.qml:83:9: QML ContentItemLoader: List didn't append all objects
org.kde.tokodon.http: QVariant(int, 401) QUrl("https://social.linux.pizza/api/v1/preferences")
org.kde.tokodon.http: QVariant(int, 401) QUrl("https://social.linux.pizza/api/v1/follow_requests")
qrc:/qt/qml/org/kde/tokodon/content/ui/LoginFlow/LoginIssuePage.qml:14:1: QML LoginIssuePage: Created graphical object was not placed in the graphics scene.
qrc:/qt/qml/org/kde/kirigamiaddons/formcard/FormTextDelegate.qml:83:9: QML ContentItemLoader: List didn't append all objects
org.kde.tokodon.http: QVariant(int, 401) QUrl("https://social.linux.pizza/api/v1/accounts/verify_credentials")
qrc:/qt/qml/org/kde/tokodon/content/ui/LoginFlow/LoginIssuePage.qml:14:1: QML LoginIssuePage: Created graphical object was not placed in the graphics scene.
qrc:/qt/qml/org/kde/kirigamiaddons/formcard/FormTextDelegate.qml:83:9: QML ContentItemLoader: List didn't append all objects
qrc:/qt/qml/org/kde/tokodon/content/ui/LoginFlow/LoginIssuePage.qml:14:1: QML LoginIssuePage: Created graphical object was not placed in the graphics scene.
qrc:/qt/qml/org/kde/kirigamiaddons/formcard/FormTextDelegate.qml:83:9: QML ContentItemLoader: List didn't append all objects
org.kde.tokodon.http: QVariant(int, 401) QUrl("https://social.linux.pizza/api/v1/follow_requests")
org.kde.tokodon.http: QVariant(int, 401) QUrl("https://social.linux.pizza/api/v1/preferences")
```
Comment 1 Joshua Goins 2024-08-08 21:19:21 UTC
Can you open KWalletManager and see if the access token is still in there? It should be under the "Tokodon" folder.

Something else worth trying is checking the Mastodon server, going under Account > Authorized apps and checking if Tokodon is still authorized there.
Comment 2 Vincent Wilms 2024-08-08 21:23:41 UTC
(In reply to Joshua Goins from comment #1)
> Can you open KWalletManager and see if the access token is still in there?
> It should be under the "Tokodon" folder.
> 
> Something else worth trying is checking the Mastodon server, going under
> Account > Authorized apps and checking if Tokodon is still authorized there.

Thank you, the access token is not there. I could be that I deleted in during my trials to use KeePassXC as a replacement for KWallet. Tokodon is still authorized in the Mastodon server. What can I do next?
Comment 3 Joshua Goins 2024-08-09 12:40:19 UTC
(In reply to Vincent Wilms from comment #2)
> (In reply to Joshua Goins from comment #1)
> > Can you open KWalletManager and see if the access token is still in there?
> > It should be under the "Tokodon" folder.
> > 
> > Something else worth trying is checking the Mastodon server, going under
> > Account > Authorized apps and checking if Tokodon is still authorized there.
> 
> Thank you, the access token is not there. I could be that I deleted in
> during my trials to use KeePassXC as a replacement for KWallet. Tokodon is
> still authorized in the Mastodon server. What can I do next?

It should be easy now, access the settings menu in the top left (the same one you would use when logged in) and log out of the account. Then you should be able to log back in as normal.

Note that this should be vastly improved in the next version, I put a "Log out" button right on the error page :-)

If you somehow cannot log out inside of Tokodon, it should be possible to remove tokodonstaterc from the flatpak data dir. It should be in an org.kde.tokodon folder somewhere in ~/.var
Comment 4 Vincent Wilms 2024-08-09 12:45:48 UTC
Thank you! I was able to log out and log in again, but the error remained. I then deleted ~/.var/app/org.kde.tokodon/data/KDE/tokodon/tokodonstaterc and logged in another time. Now it works :-)
Comment 5 Joshua Goins 2024-12-01 00:19:20 UTC
I have seemed to fix this bug, and asked for one of the KDE Flatpak maintainers to backport the fix. I successfully went from (fixed) 24.08 -> 24.12 -> git master now without the access token disappearing.
Comment 6 Vincent Wilms 2024-12-03 08:13:05 UTC
(In reply to Joshua Goins from comment #5)
> I have seemed to fix this bug, and asked for one of the KDE Flatpak
> maintainers to backport the fix. I successfully went from (fixed) 24.08 ->
> 24.12 -> git master now without the access token disappearing.

That's great, thank you!