Skip to content

Fixes token expiry issues#20

Open
5E7EN wants to merge 2 commits intoKoenZomers:masterfrom
5E7EN:master
Open

Fixes token expiry issues#20
5E7EN wants to merge 2 commits intoKoenZomers:masterfrom
5E7EN:master

Conversation

@5E7EN
Copy link
Copy Markdown

@5E7EN 5E7EN commented Feb 20, 2024

The logic that checks for token expiry was not using a valid datetime since the assignment is broken in the OAuthToken implementation.
After getting a token response from the auth endpoint, the program was never setting the expiry date to the OAuthToken class, so any check for token expiry would always return true.

As a result, any calls to the EnsureSessionValid() method triggered a token refresh for each video download, causing the API to eventually throw a "too many token requests" error.

This PR adds a new property in the OAuthToken class to store the actual expiry date as provided by the auth API when the request for a token is made. This enables expiry validation to return accurate results.

Closes #17

@5E7EN
Copy link
Copy Markdown
Author

5E7EN commented Feb 22, 2024

@KoenZomers got a chance to review and merge these changes?

/// Gets a DateTime with when this token expires
/// </summary>
public DateTime ExpiresAt { get; private set; }
public DateTime ExpiresAt
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @5E7EN thanks for your contribution, would you mind following the same pattern as the RingApi project to keep it consistent please?
https://github.com/KoenZomers/RingApi/blob/master/Api/Entities/OAuthToken.cs#L28

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.

Download Fails after some time

2 participants