@@ -34,12 +34,12 @@ impl AuthenticationManager {
34
34
///
35
35
/// 1. Check if the `GOOGLE_APPLICATION_CREDENTIALS` environment variable if set;
36
36
/// if so, use a custom service account as the token source.
37
- /// 2. Check if the ` gcloud` tool is available on the `PATH`; if so, use the
38
- /// `gcloud auth print-access-token` command as the token source .
37
+ /// 2. Look for credentials in `.config/ gcloud/application_default_credentials.json`;
38
+ /// if found, use these credentials to request refresh tokens .
39
39
/// 3. Send a HTTP request to the internal metadata server to retrieve a token;
40
40
/// if it succeeds, use the default service account as the token source.
41
- /// 4. Look for credentials in `.config/ gcloud/application_default_credentials.json`;
42
- /// if found, use these credentials to request refresh tokens .
41
+ /// 4. Check if the ` gcloud` tool is available on the `PATH`; if so, use the
42
+ /// `gcloud auth print-access-token` command as the token source .
43
43
#[ tracing:: instrument]
44
44
pub async fn new ( ) -> Result < Self , Error > {
45
45
tracing:: debug!( "Initializing gcp_auth" ) ;
@@ -48,9 +48,9 @@ impl AuthenticationManager {
48
48
}
49
49
50
50
let client = types:: client ( ) ;
51
- let gcloud_error = match GCloudAuthorizedUser :: new ( ) . await {
51
+ let default_user_error = match DefaultAuthorizedUser :: new ( & client ) . await {
52
52
Ok ( service_account) => {
53
- tracing:: debug!( "Using GCloudAuthorizedUser " ) ;
53
+ tracing:: debug!( "Using DefaultAuthorizedUser " ) ;
54
54
return Ok ( Self :: build ( client, service_account) ) ;
55
55
}
56
56
Err ( e) => e,
@@ -64,9 +64,9 @@ impl AuthenticationManager {
64
64
Err ( e) => e,
65
65
} ;
66
66
67
- let default_user_error = match DefaultAuthorizedUser :: new ( & client ) . await {
67
+ let gcloud_error = match GCloudAuthorizedUser :: new ( ) . await {
68
68
Ok ( service_account) => {
69
- tracing:: debug!( "Using DefaultAuthorizedUser " ) ;
69
+ tracing:: debug!( "Using GCloudAuthorizedUser " ) ;
70
70
return Ok ( Self :: build ( client, service_account) ) ;
71
71
}
72
72
Err ( e) => e,
0 commit comments