• Home
  • Raw
  • Download

Lines Matching full:credentials

15 """Application default credentials.
17 Implements application default credentials and project ID detection.
32 """Loads Google credentials from a file.
34 The credentials file must be a service account key or stored authorized
35 user credentials.
38 filename (str): The full path to the credentials file.
39 scopes (Optional[Sequence[str]]): The list of scopes for the credentials. If
40 specified, the credentials will automatically be scoped if
46 Tuple[google.auth.credentials.Credentials, Optional[str]]: Loaded
47 credentials and the project ID. Authorized user credentials do not
69 # credentials file or an authorized user credentials file.
73 from google.oauth2 import _credentials_async as credentials unknown
76 credentials = credentials.Credentials.from_authorized_user_info(
80 msg = "Failed to load authorized user credentials from {}".format(filename)
84 credentials = credentials.with_quota_project(quota_project_id)
85 if not credentials.quota_project_id:
86 _default._warn_about_problematic_credentials(credentials)
87 return credentials, None
93 credentials = service_account.Credentials.from_service_account_info(
97 msg = "Failed to load service account credentials from {}".format(filename)
100 return credentials, info.get("project_id")
112 """Gets the credentials and project ID from the Cloud SDK."""
115 # Check if application default credentials exist.
121 credentials, project_id = load_credentials_from_file(
128 return credentials, project_id
132 """Gets credentials from the GOOGLE_APPLICATION_CREDENTIALS environment
137 explicit_file = os.environ.get(environment_vars.CREDENTIALS)
141 # file path is cloud sdk credentials path, then we should fall back
146 credentials, project_id = load_credentials_from_file(
147 os.environ[environment_vars.CREDENTIALS], quota_project_id=quota_project_id
150 return credentials, project_id
157 """Gets Google App Engine App Identity credentials and project ID."""
165 """Gets credentials and project ID from the GCE Metadata Service."""
166 # Ping requires a transport, but we want application default credentials
178 """Gets the default credentials for the current environment.
180 `Application Default Credentials`_ provides an easy way to obtain
181 credentials to call Google APIs for server-to-server or local applications.
182 This function acquires credentials from the environment in the following
191 credentials set they are loaded and returned.
193 To enable application default credentials with the Cloud SDK run::
203 (first generation) then the credentials and project ID from the
207 environment`_ (second generation) then the credentials and project ID
209 5. If no credentials are found,
212 .. _Application Default Credentials: https://developers.google.com\
213 /identity/protocols/application-default-credentials
229 credentials, project_id = google.auth.default()
232 scopes (Sequence[str]): The list of scopes for the credentials. If
233 specified, the credentials will automatically be scoped if
242 Tuple[~google.auth.credentials.Credentials, Optional[str]]:
243 the current environment's credentials and project ID. Project ID
249 If no credentials were found, or if the credentials found were
266 credentials, project_id = checker()
267 if credentials is not None:
268 credentials = with_scopes_if_required(
269 credentials, scopes
279 return credentials, effective_project_id