Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Application Default Credentials take precedence over EmulatorCredentials

未關閉
#634 2 則留言 4 個 reaction 已指派 1 人 在 GitHub 檢視

@yuchenshi 已經在處理了。

開始於 2022年1月26日。

評估

這個 Issue 還沒有評估資料。

描述

api: firestore type: bug
Environment
  • Operating System version: Fedora 35
  • Firebase SDK version: Firebase Admin Java
  • Library version: 8.1.0
  • Firebase Product: firestore
Problem

If I have an Application Default Credentials File in ~/.config/gcloud/ than I get a warning about using user credentials for a server application while running my test against the emulator.
I do not expect to get this message as I am initializing the SDK with credentials provided and Javadoc for the Firestore Builder states that Application Defaults are only taken if Credentials are null.

Steps to reproduce:

Initialize the SDK in a Junit test like stated below.

Starting the test, the SDK will log the following message if there are Application Default Credentials:
"WARN com.google.auth.oauth2.DefaultCredentialsProvider - Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/."

Though, the test itself seems to run against the emulator just fine. Once I remove the Credentials by moving the credentials file, the test runs without warning.

Relevant Code:
private val firestoreEmulator: Firestore by lazy {
		FirestoreOptions.getDefaultInstance().toBuilder()
			.setEmulatorHost(emulator.emulatorEndpoint)
			.setCredentials(FirestoreOptions.EmulatorCredentials())
			.setProjectId("demo-project")
			.build().service
	}
主要語言
Java
星號
620
分支
305
平均合併
4 天 9 小時
30 天內合併 PR
4

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

firebase/firebase-admin-java 的其他 Issue

查看 firebase/firebase-admin-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。