pub fn create_token(&self, secret: &str) -> Result<String, String> {
        return match encode(
            &Header::default(),
            self,
            &EncodingKey::from_secret(secret.as_ref()),
        ) {
            Ok(t) => Ok(t),
            Err(_) => Err(String::from("JWTToken encode fail!")), // in practice you would return the error
        };
    }
/// create token
/// secret: your secret string
create token
secret: your secret string
create token secret : your secret string
pub fn create_token(&self, secret: &str) -> Result<String, String> {
        return match encode(
            &Header::default(),
            self,
            &EncodingKey::from_secret(secret.as_ref()),
        ) {
            Ok(t) => Ok(t),
            Err(_) => Err(String::from("JWTToken encode fail!")), // in practice you would return the error
        };
    }
pub fn create_token ( & self , secret : & str ) -> Result < String , String > { return match encode ( & Header :: default ( ) , self , & EncodingKey :: from_secret ( secret . as_ref ( ) ) , ) { Ok ( t ) => Ok ( t ) , Err ( _ ) => Err ( String :: from ( " " ) ) , // in practice you would return the error } ; }
create token
secret: your secret string
create token secret : your secret string
&self
secret
&str
&self
secret
&str