Skip to content

Token from storage should expire but hasExpired always returns false #942

Open
@edsonhoraciojunior

Description

@edsonhoraciojunior

I'm using OAuth 2 with Forge Autodesk, they usually return tokens with expires_in: 3599.
If I get a token from storage and run

$token = new AccessToken($token);
if ($token->hasExpired()) {
    $this->refreshToken($token);
}

$accessToken->hasExpired() always return false, because on the construct the expiration date is calculated with timeNow + expires_in.
With this logic, the token will never expire, which is incorrect.

  1. Is this logic incorrect?
  2. Am I using OAuth wrong? Am I expected to always refresh the token before using it for the second time, even if it didn't expire?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions