Skip to content

Commit

Permalink
Disable jwt expiry check when checking if account is premium
Browse files Browse the repository at this point in the history
  • Loading branch information
bytedream committed Apr 24, 2024
1 parent 04d35b8 commit 364a941
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/crunchyroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ mod auth {
let token = executor_config.access_token.as_str();
let key = jsonwebtoken::DecodingKey::from_rsa_components("", "").unwrap();
let mut validation = jsonwebtoken::Validation::default();
// the jwt might be expired when calling this function. but there is no really need to
// refresh it if this case happens. sure, it might be that the premium status of the
// user changes when re-requesting the token but the possibility of this is tiny
validation.validate_exp = false;
// we just want the jwt claims, no need to check the signature. spoofing the jwt cannot
// do anything harmful in this function anyway
validation.insecure_disable_signature_validation();

jsonwebtoken::decode::<AccessTokenClaims>(token, &key, &validation)
Expand Down

0 comments on commit 364a941

Please sign in to comment.