get_auth_token.py (878B)
1 #!/usr/bin/env vpython3 2 # Copyright 2023 The Chromium Authors 3 # Use of this source code is governed by a BSD-style license that can be 4 # found in the LICENSE file. 5 """Print the default service account's auth token to stdout.""" 6 7 from __future__ import absolute_import 8 import os 9 import subprocess 10 import sys 11 12 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 13 'test'))) 14 from common import DIR_SRC_ROOT 15 16 sys.path.append(os.path.join(DIR_SRC_ROOT, 'build')) 17 import find_depot_tools 18 19 20 def main(): 21 luci_auth = os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'luci-auth') 22 proc = subprocess.run([ 23 luci_auth, 'token', '-scopes', 24 'https://www.googleapis.com/auth/devstorage.read_only' 25 ], 26 encoding='utf-8') 27 return proc.returncode 28 29 30 if __name__ == '__main__': 31 sys.exit(main())