Check device code flow credential.is_expired
ref:
@@ -128,6 +128,9 @@ class DeviceCodeGrant(BaseGrant, TokenEndpointMixin):
return 200, token, self.TOKEN_RESPONSE_HEADER
def validate_device_credential(self, credential):
+ if credential.is_expired():
+ raise ExpiredTokenError()
+
user_code = credential.get_user_code()
user_grant = self.query_user_grant(user_code)
@@ -137,9 +140,6 @@ class DeviceCodeGrant(BaseGrant, TokenEndpointMixin):
raise AccessDeniedError()
return user
- if credential.is_expired():
- raise ExpiredTokenError()
-
if self.should_slow_down(credential):
raise SlowDownError()
