Skip to content

Conversation

NBA2K1
Copy link
Contributor

@NBA2K1 NBA2K1 commented Jul 25, 2025

This PR fixes the following issue:
When the user logged in with mobile, the mobile clientId was being used to login. When the token expires and the user is now on desktop, the desktop clientId will be used to get the new token, leading to a {"error":"invalid_request","message":"The refresh token is invalid.","hint":"Token is not linked to client"} response from MAL.

Now the used clientId is being saved on login in the OAuth model and is being used when refreshing the token.
If the user logged in before this change, and therefore OAuth.clientId is null, the clientId for the current platform will be tried to get the refresh token. If it fails, it will fallback to the other clientId.
If that also fails, it will log the user out of MAL with the botToast message "MyAnimeList Token expired".

Also refactored the code a little to reduce some duplication and enhance readability.

@kodjodevf kodjodevf merged commit 10ee707 into kodjodevf:main Jul 27, 2025
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 this pull request may close these issues.

2 participants