diff --git a/examples/custom_storage.rs b/examples/custom_storage.rs index e78ad3c..6d44226 100644 --- a/examples/custom_storage.rs +++ b/examples/custom_storage.rs @@ -74,11 +74,9 @@ async fn main() { sec, yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect, ) - .with_storage(yup_oauth2::authenticator::StorageType::Custom(Box::new( - ExampleTokenStore { - store: RwLock::new(vec![]), - }, - ))) + .with_storage(Box::new(ExampleTokenStore { + store: RwLock::new(vec![]), + })) .build() .await .expect("InstalledFlowAuthenticator failed to build"); diff --git a/src/authenticator.rs b/src/authenticator.rs index bd2cf83..a23a18a 100644 --- a/src/authenticator.rs +++ b/src/authenticator.rs @@ -238,9 +238,9 @@ impl AuthenticatorBuilder { } /// Use the provided token storage mechanism - pub fn with_storage(self, storage_type: StorageType) -> Self { + pub fn with_storage(self, storage: Box) -> Self { AuthenticatorBuilder { - storage_type: storage_type, + storage_type: StorageType::Custom(storage), ..self } } @@ -504,7 +504,7 @@ where } /// How should the acquired tokens be stored? -pub enum StorageType { +enum StorageType { /// Store tokens in memory (and always log in again to acquire a new token on startup) Memory, /// Store tokens to disk in the given file. Warning, this may be insecure unless you configure your operating system to restrict read access to the file.