Wykonywanie wywołań Menedżera danych logowania w imieniu innych osób w przypadku aplikacji z uprawnieniami
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Aplikacje z uprawnieniami dostępu, takie jak przeglądarki, mogą wykonywać wywołania Menedżera danych logowania w imieniu innych podmiotów uzależnionych, ustawiając parametr origin w metodach GetCredentialRequest() i CreatePublicKeyCredentialRequest() usługi Credential Manager.
origin reprezentuje aplikację lub witrynę, z której pochodzi żądanie, i jest używany przez klucze dostępu do ochrony przed atakami phishingowymi.
Serwery aplikacji muszą sprawdzić, czy dane klienta origin znajdują się na liście dozwolonych zatwierdzonych aplikacji i witryn. Jeśli serwer otrzyma żądanie z aplikacji lub strony internetowej z nierozpoznanego źródła, powinno zostać odrzucone.
W tym dokumencie opisujemy, jak ustawić źródło takich aplikacji do wykonywania połączeń z podwyższonymi uprawnieniami oraz jak sprawdzić, czy mogą one wykonywać połączenia w imieniu innych osób.
Ustaw źródło aplikacji do rozmów
Aby uzyskać dane logowania w imieniu innej strony uzależnionej, dostawca danych logowania, który je dostarcza, musi dodać Twoją aplikację do listy elementów wywołujących z uprawnieniami, które mogą uzyskać taki dostęp. Następnie użyj funkcji setOrigin() w żądaniach createCredential() i getCredential(), aby ustawić wartość origin.
W przypadku aplikacji z uprawnieniami, takich jak przeglądarki, które muszą obsługiwać dane logowania innych firm, Menedżer haseł Google wymaga zatwierdzenia do obsługi tych danych logowania. Dzięki temu tylko zaufane aplikacje mają dostęp do danych logowania użytkownika do usług zewnętrznych i mogą nimi zarządzać. Aby uzyskać pozwolenie na obsługę danych logowania od innych firm, wypełnij formularz zgłoszeniowy, aby poprosić o sprawdzenie.
Treść strony i umieszczone na niej fragmenty kodu podlegają licencjom opisanym w Licencji na treści. Java i OpenJDK są znakami towarowymi lub zastrzeżonymi znakami towarowymi należącymi do firmy Oracle lub jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-27 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-07-27 UTC."],[],[],null,["# Make Credential Manager calls on behalf of other parties for privileged apps\n\nPrivileged apps such as web browsers can make a Credential Manager call on\nbehalf of other relying parties by setting the `origin` parameter in Credential\nManager's [`GetCredentialRequest()`](/reference/androidx/credentials/GetCredentialRequest#GetCredentialRequest(kotlin.collections.List,kotlin.String,kotlin.Boolean,android.content.ComponentName,kotlin.Boolean)) and\n[`CreatePublicKeyCredentialRequest()`](/reference/androidx/credentials/CreatePublicKeyCredentialRequest#CreatePublicKeyCredentialRequest(kotlin.String,kotlin.ByteArray,kotlin.Boolean,kotlin.String,kotlin.Boolean)) methods.\n\nThe [`origin`](https://www.w3.org/TR/webauthn-2/#dom-collectedclientdata-origin) represents the application or website that a\nrequest comes from, and is used by passkeys to protect against phishing attacks.\nAn app's servers are required to check the client data `origin` against an\nallowlist of approved apps and websites. If the server receives a request from\nan app or website from an unrecognized origin, the request should be rejected.\nThis document describes how to set the origin for such privileged calling apps,\nand how to verify such apps are allowed to make calls on behalf of other\nparties.\n\nSet the origin of the calling app\n---------------------------------\n\nTo get credentials on behalf of another relying party, the credential provider\nthat supplies the credentials must add your app to a list of privileged callers\nthat are allowed to get such access. Then, use [`setOrigin()`](/reference/android/credentials/GetCredentialRequest.Builder#setOrigin(java.lang.String)) on\n[`createCredential()`](/reference/kotlin/androidx/credentials/CredentialManager#createCredential(android.content.Context,androidx.credentials.CreateCredentialRequest)) and [`getCredential()`](/reference/kotlin/androidx/credentials/CredentialManager#getCredential(android.content.Context,androidx.credentials.PrepareGetCredentialResponse.PendingGetCredentialHandle)) requests to set the\n`origin` value.\n| **Note:** The `origin` parameter in the `createCredential()` and `getCredential()` methods is only effective in API levels 34 (Android 14) and higher.\n\nFor privileged apps such as web browsers that need to handle third party\ncredentials, Google Password Manager requires approval to handle those\ncredentials. This ensures that only trusted apps are able to access and manage\nuser credentials for external services. To be approved for handling third party\ncredentials, [complete the request form](https://docs.google.com/forms/d/e/1FAIpQLScRuk9tTg0QPfSWl9SbpbIorX8xx2FCXlmoUYftCX2MxG4qyg/viewform) to open a ticket and\nhave your request reviewed."]]