Skip to content

Commit 173062a

Browse files
Googlera-maurice
authored andcommitted
Add support to parse first instance of the Oauth Android Client Id
Testing Done: $ blaze test firebase/app/client/cpp:generate_xml_from_google_services_json_test PiperOrigin-RevId: 310193460
1 parent a906eb0 commit 173062a

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed
-4.2 MB
Binary file not shown.

generate_xml_from_google_services_json.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
# Output filename for .json files, if it isn't set.
4949
DEFAULT_JSON_OUTPUT_FILENAME = 'google-services-desktop.json'
5050

51-
# Indicates a web client in the oauth_client list.
51+
OAUTH_CLIENT_TYPE_ANDROID_APP = 1
5252
OAUTH_CLIENT_TYPE_WEB = 3
5353

5454

@@ -391,15 +391,24 @@ def main():
391391
if client_info:
392392
gen_string(root, 'google_app_id', client_info.get('mobilesdk_app_id'))
393393

394+
# Only include the first matching OAuth client ID per type.
395+
client_id_web_parsed = False
396+
client_id_android_parsed = False
397+
394398
oauth_client_list = selected_client.get('oauth_client')
395399
if oauth_client_list:
396400
for oauth_client in oauth_client_list:
397401
client_type = oauth_client.get('client_type')
398402
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):
400406
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
403412

404413
services = selected_client.get('services')
405414
if services:

0 commit comments

Comments
 (0)