/// Check the validity of a token
Check the validity of a token
Check the validity of a token
pub async fn is_token_valid(&self, token: &str) -> bool {
        let c = self.client.with_token(token.to_owned());
        let res: Value = c.get("/auth/token/lookup-self").await.unwrap_or(Value::Null);
        let ttl = res["data"]["ttl"].as_i64().unwrap_or(0);
        ttl > 120
    }
pub async fn is_token_valid ( & self , token : & str ) -> bool { let c = self . client . with_token ( token . to_owned ( ) ) ; let res : Value = c . get ( " " ) . await . unwrap_or ( Value :: Null ) ; let ttl = res [ " " ] [ " " ] . as_i64 ( ) . unwrap_or ( 0 ) ; ttl > 120 }
Check the validity of a token
Check the validity of a token
&self
token
&str