본문으로 건너뛰기
Skillpedia
보안10k · #11916

restore-credentials

하는 일

이 스킬은 Credential Manager 라이브러리를 사용해 Android 쪽의 Restore Credentials를 구현하는 방법을 안내합니다. 앱이 새 기기에 복원된 뒤에도 기존 사용자가 자동으로 다시 로그인할 수 있게 합니다. 이미 Credential Manager를 쓰고 있는 Android 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓앱을 새 휴대폰에 복원한 뒤 사용자가 자동으로 다시 로그인하게 하고 싶을 때.
  • ✓Android 앱에서 복원 키를 만들고, 이 키로 로그인하고, 삭제해야 할 때.
  • ✓복원 기능이 작동하려면 백엔드가 무엇을 해야 하는지 알아야 할 때.

스킬 링크

https://github.com/android/skills/blob/main/identity/restore-credentials/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/android/skills/blob/main/identity/restore-credentials/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“내 Android 앱에 Restore Credentials를 추가해서, 사용자가 새 휴대폰으로 복원한 뒤에도 다시 로그인할 수 있게 해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 스킬은 두 단계로 된 복원 구조를 설명한 뒤, 앱에서 복원 키를 만들고, 가져오고, 삭제하는 코드를 추가합니다. 마지막으로 직접 만들어야 할 백엔드 단계 목록을 제시합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Fundamentals

The objective is to implement the Restore Credentials feature through the Android Credential Manager API (androidx.credentials). This allows apps that use or are integrating Credential Manager to silently log users back in when they restore their app on a new device. Restore Credentials operates independently of the app's primary authentication method (passwords, passkeys, federated sign-in) and requires no UI changes to existing sign-in flows.

Scope

Crucial: This skill focuses exclusively on the Android client-side integration. It does not implement the server-side cryptographic validation logic. The developer must be reminded of this and the Points to inform the developer about after implementation is done.

Implementation Guidelines

When instructed to implement Restore Credentials on a developer's application, remember the following:

  1. Before the implementation, you MUST read and understand the Two-Tier Restoration Architecture and review the DOs and DON'Ts.
  2. After the implementation, you MUST present the developer with the Backend Guidelines as a reminder for their backend setup. It is important that you remind the developer that they still have to implement the backend.

Two-Tier Restoration Architecture

To enable a resilient sign-in experience, retrieve credentials through a two-tier architecture:

  1. Tier 1 (Primary - Background): Executes automatically during device setup using the app's BackupAgent.onRestoreFinished() callback. This provides an invisible restoration before the user opens the app for the first time, allowing background sync and notification delivery.
  2. Tier 2 (Secondary - Foreground): Runs in the Launcher Activity.onCreate() to catch failovers if background restoration didn't complete (example: dropped network, delayed restoration) or if allowBackup is disabled.

If allowBackup in the manifest is set to true, implement both. Otherwise, only implement tier 2 (Foreground Restoration). Do NOT change the value of allowBackup in the manifest.

If you added a BackupAgent to the app, you MUST also set android:fullBackupOnly="true" in the manifest. Do NOT do this if there already existed a BackupAgent in the app before your implementation.

DOs and DON'Ts

DO:

  • Do check AndroidManifest.xml for the value of allowBackup to determine what you have to implement.
  • Do implement a fallback for createCredential: always try calling it first with isCloudBackupEnabled set to true. If an E2eeUnavailableException is thrown, catch it and retry the call with isCloudBackupEnabled set to false.
  • Do implement a BackupAgent (subclass of android.app.backup.BackupAgent) if allowBackup is true in the manifest.
  • Do set android:fullBackupOnly="true" in the manifest if you added a BackupAgent to the app.
  • Call clearCredentialState() when the user signs out. This is a mandatory security measure to log the user out fully.
  • Do attempt to get the restore key on the first launch of the app on a new device and also within the BackupAgent.onRestoreFinished() callback if your app uses it.
  • Do ensure that a restore credential is created even if the user is already logged in.
  • Do ensure that the credential retrieval and login in onRestoreFinished() is performed synchronously (for example using runBlocking).
  • Do restore notifications in the BackupAgent if your app uses them. (For example capture and send FCM token to backend)
  • Do ensure that if you implement mock network requests or stubs, you replace all placeholders with valid, properly formatted JSON payloads for the credential requests.
  • Do encapsulate credential creation and retrieval into their own dedicated functions. Because credential creation must be called in multiple places (sign-up, sign-in) and retrieval across multiple tiers (BackupAgent and Launcher Activity), this prevents code duplication.
  • Do remind the developer of the critical guidelines for implementing the backend once you're done with the implementation.
  • Do generate a separate restore key for each application if the organization has multiple apps with different package names, as a restore key is tied to a unique application package name.

DON'T:

  • DON'T change the value of allowBackup in AndroidManifest.xml. Restore Credenti
자주 묻는 질문

스킬이 제 서버를 만들어 주나요?

아니요. Android 앱 쪽만 다루며, 백엔드 확인은 직접 만들어야 한다고 알려 줍니다.

제 로그인 화면이 바뀌나요?

아니요. 이 기능은 기존 로그인과 함께 작동하며 UI 변경이 필요하지 않습니다.

어떤 라이브러리를 사용하나요?

Credential Manager API의 androidx.credentials 라이브러리를 사용합니다.

상세 정보

작성자의 원본 설명

Provides knowledge and workflows to implement Android's Restore Credentials feature using the androidx.credentials library. Use this skill to create, sign in with, and delete restore keys, enabling silent user sign-in on new devices after a restore. It covers version compatibility, dependencies, server-side prerequisites, and the complete client-side implementation for creating, retrieving, and clearing restore keys.

repo: android/skills

인기도

GitHub 스타
10k
순위
#11916
라이선스
Apache-2.0
업데이트
2026. 10. 29.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬