Skip to content

Commit

Permalink
Improve login fail message
Browse files Browse the repository at this point in the history
  • Loading branch information
rrousselGit committed Oct 20, 2023
1 parent c6224f1 commit 6e38096
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion googleapis_auth/lib/auth_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,18 @@ Future<AutoRefreshingAuthClient> clientViaApplicationDefaultCredentials({
);
}

return await clientViaMetadataServer(baseClient: baseClient);
try {
return await clientViaMetadataServer(baseClient: baseClient);
} on Exception catch (err, stack) {
Error.throwWithStackTrace(
Exception(
'Failed to load Application Default Credentials. '
'Make sure you are logged in with `firebase` or `gcloud` CLI, '
'or your code is running on Google Compute Engine/Google App Engine.',
),
stack,
);
}
}

/// Obtains oauth2 credentials and returns an authenticated HTTP client.
Expand Down

0 comments on commit 6e38096

Please sign in to comment.