Skip to content

Wrong token may be used for fetching notifications when using multiple #2176

@mashiro

Description

@mashiro

🔍 Is there already an issue for your problem?

  • I have checked older issues, open and closed

📝 Description

When using multiple accounts and notifications span multiple pages, a token that is not associated with the account and server is used.
I believe this is likely due to using axios.defaults for passing authentication credentials, resulting in the following behavior:

Fetch notifications for Account 1 (Token 1 is set in authentication credentials)
Fetch notifications for Account 2 (Token 2 is set in authentication credentials)
Fetch page 2 of notifications for Account 1 (Token 2 is used because it's not reset during pagination)

https://github.com/gitify-app/gitify/blob/main/src/renderer/utils/api/request.ts#L57

🪜 Steps To Reproduce

  1. Add two accounts
  2. Have Account 1's notifications reach the second page
  3. Disabling "Fetch all notifications" prevents the error from occurring

🪵 Log Excerpts

GET https://api.github.com/notifications?participating=false&page=2 401 (Unauthorized)

Gitify Version

6.6.0

Operating System

macOS

GitHub Account

Combination

📸 Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions