Skip to content

Commit

Permalink
Update src/fastapi_oauth2/middleware.py
Browse files Browse the repository at this point in the history
Co-authored-by: Artyom Vancyan <44609997+ArtyomVancyan@users.noreply.github.com>
  • Loading branch information
Scurrra and ArtyomVancyan authored Jul 21, 2024
1 parent 6dbfd40 commit fc60e7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/fastapi_oauth2/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async def authenticate(self, request: Request) -> Optional[Tuple[Auth, User]]:
return Auth(), User()

token_data = Auth.jwt_decode(param)
if token_data["exp"] and token_data["exp"] < int(datetime.now(UTC).timestamp()):
if token_data["exp"] and token_data["exp"] < int(datetime.now(timezone.utc).timestamp()):
raise OAuth2AuthenticationError(401, "Token expired")

user = User(token_data)
Expand Down

0 comments on commit fc60e7d

Please sign in to comment.