mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-02-23 15:50:00 +01:00
added access token authenticator
This commit is contained in:
@@ -5,6 +5,7 @@ use yup_oauth2::{
|
||||
ApplicationDefaultCredentialsAuthenticator, ApplicationDefaultCredentialsFlowOpts,
|
||||
ApplicationSecret, DeviceFlowAuthenticator, Error, InstalledFlowAuthenticator,
|
||||
InstalledFlowReturnMethod, ServiceAccountAuthenticator, ServiceAccountKey,
|
||||
AccessTokenAuthenticator,
|
||||
};
|
||||
|
||||
use std::future::Future;
|
||||
@@ -643,3 +644,16 @@ async fn test_default_application_credentials_from_metadata_server() {
|
||||
.unwrap();
|
||||
assert_eq!(token.as_str(), "accesstoken");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_access_token() {
|
||||
let authenticator = AccessTokenAuthenticator::with_client("0815".to_string(), DefaultHyperClient)
|
||||
.build()
|
||||
.await
|
||||
.unwrap();
|
||||
let token = authenticator
|
||||
.token(&["https://googleapis.com/some/scope"])
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(token.as_str(), "0815".to_string());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user