|
48 | 48 | # Output filename for .json files, if it isn't set.
|
49 | 49 | DEFAULT_JSON_OUTPUT_FILENAME = 'google-services-desktop.json'
|
50 | 50 |
|
51 |
| -# Indicates a web client in the oauth_client list. |
| 51 | +OAUTH_CLIENT_TYPE_ANDROID_APP = 1 |
52 | 52 | OAUTH_CLIENT_TYPE_WEB = 3
|
53 | 53 |
|
54 | 54 |
|
@@ -391,15 +391,24 @@ def main():
|
391 | 391 | if client_info:
|
392 | 392 | gen_string(root, 'google_app_id', client_info.get('mobilesdk_app_id'))
|
393 | 393 |
|
| 394 | + # Only include the first matching OAuth client ID per type. |
| 395 | + client_id_web_parsed = False |
| 396 | + client_id_android_parsed = False |
| 397 | + |
394 | 398 | oauth_client_list = selected_client.get('oauth_client')
|
395 | 399 | if oauth_client_list:
|
396 | 400 | for oauth_client in oauth_client_list:
|
397 | 401 | client_type = oauth_client.get('client_type')
|
398 | 402 | client_id = oauth_client.get('client_id')
|
399 |
| - if client_type and client_type == OAUTH_CLIENT_TYPE_WEB and client_id: |
| 403 | + if not (client_type and client_id): continue |
| 404 | + if (client_type == OAUTH_CLIENT_TYPE_WEB and |
| 405 | + not client_id_web_parsed): |
400 | 406 | gen_string(root, 'default_web_client_id', client_id)
|
401 |
| - # Only include the first matching OAuth web client ID. |
402 |
| - break |
| 407 | + client_id_web_parsed = True |
| 408 | + if (client_type == OAUTH_CLIENT_TYPE_ANDROID_APP and |
| 409 | + not client_id_android_parsed): |
| 410 | + gen_string(root, 'default_android_client_id', client_id) |
| 411 | + client_id_android_parsed = True |
403 | 412 |
|
404 | 413 | services = selected_client.get('services')
|
405 | 414 | if services:
|
|
0 commit comments