Skip to content

Commit db877a1

Browse files
committed
more human cleanup
1 parent 054114b commit db877a1

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

googleapis_auth/lib/src/oauth2_flows/metadata_server.dart

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class MetadataServerAuthorizationFlow extends BaseFlow {
2222
final String email;
2323
final http.Client _client;
2424

25-
MetadataServerAuthorizationFlow(this._client, {this.email = 'default'});
25+
MetadataServerAuthorizationFlow(http.Client client, {this.email = 'default'})
26+
: _client = client;
2627

2728
@override
2829
Future<AccessCredentials> run({bool refresh = false}) async {
@@ -33,7 +34,11 @@ class MetadataServerAuthorizationFlow extends BaseFlow {
3334
final json = jsonDecode(tokenJsonString) as Map<String, dynamic>;
3435
final accessToken = parseAccessToken(json);
3536

36-
final scopesString = await _getScopes(refresh: refresh);
37+
final scopesString = await getMetadataValue(
38+
'instance/service-accounts/$email/scopes',
39+
client: _client,
40+
refresh: refresh,
41+
);
3742
final scopes = scopesString
3843
.replaceAll('\n', ' ')
3944
.split(' ')
@@ -42,10 +47,4 @@ class MetadataServerAuthorizationFlow extends BaseFlow {
4247

4348
return AccessCredentials(accessToken, null, scopes);
4449
}
45-
46-
Future<String> _getScopes({bool refresh = false}) async => getMetadataValue(
47-
'instance/service-accounts/$email/scopes',
48-
client: _client,
49-
refresh: refresh,
50-
);
5150
}

0 commit comments

Comments
 (0)