Skip to content

Commit

Permalink
For some weird reason token expires sooner than it should
Browse files Browse the repository at this point in the history
  • Loading branch information
ClusterM committed Apr 7, 2022
1 parent 9f11ea4 commit 56b7a18
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion TuyaApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ public async Task<string> RequestAsync(Method method, string uri, string body =
/// </summary>
private async Task RefreshAccessTokenAsync(bool force = false)
{
if (force || (token == null) || (tokenTime.AddSeconds(token.ExpireTime) >= DateTime.Now))
if (force || (token == null) || (tokenTime.AddSeconds(token.ExpireTime) >= DateTime.Now)
// For some weird reason token expires sooner than it should
|| (tokenTime.AddMinutes(30) >= DateTime.Now))
{
var uri = "v1.0/token?grant_type=1";
var response = await RequestAsync(Method.GET, uri, noToken: true);
Expand Down

0 comments on commit 56b7a18

Please sign in to comment.