pub fn create_token(user_id: ObjectId) -> String {
    let claims = Claims {
        sub: user_id.to_string(),
        iat: Utc::now().timestamp() as usize,
        exp: (Utc::now() + Duration::days(21)).timestamp() as usize,
    };

    encode(
        &Header::default(),
        &claims,
        &EncodingKey::from_secret(get_secret().as_ref()),
    )
    .unwrap()
}
/// Create a JSON web token with the user id encoded to keep track of logged in user
Create a JSON web token with the user id encoded to keep track of logged in user
Create a JSON web token with the user id encoded to keep track of logged in user
pub fn create_token(user_id: ObjectId) -> String {
    let claims = Claims {
        sub: user_id.to_string(),
        iat: Utc::now().timestamp() as usize,
        exp: (Utc::now() + Duration::days(21)).timestamp() as usize,
    };
    encode(
        &Header::default(),
        &claims,
        &EncodingKey::from_secret(get_secret().as_ref()),
    )
    .unwrap()
}
pub fn create_token ( user_id : ObjectId ) -> String { let claims = Claims { sub : user_id . to_string ( ) , iat : Utc :: now ( ) . timestamp ( ) as usize , exp : ( Utc :: now ( ) + Duration :: days ( 21 ) ) . timestamp ( ) as usize , } ; encode ( & Header :: default ( ) , & claims , & EncodingKey :: from_secret ( get_secret ( ) . as_ref ( ) ) , ) . unwrap ( ) }
Create a JSON web token with the user id encoded to keep track of logged in user
Create a JSON web token with the user id encoded to keep track of logged in user
user_id
ObjectId
user_id
ObjectId