一键导入
verified-email
提供基于 Android Credential Manager API 实现已验证邮箱获取的完整工作流。使用此 skill 向 Android 应用集成安全、免 OTP 的邮箱验证流程。该 skill 利用来自 Google 等可信提供商的加密验证凭证,解决注册流程摩擦过大的问题。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
提供基于 Android Credential Manager API 实现已验证邮箱获取的完整工作流。使用此 skill 向 Android 应用集成安全、免 OTP 的邮箱验证流程。该 skill 利用来自 Google 等可信提供商的加密验证凭证,解决注册流程摩擦过大的问题。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
提供使用 CameraX 进行 Android 相机开发的技术指导。当实现相机功能、处理异步录制生命周期、使用 CameraX 进行底层硬件互操作,或集成 ML Kit 或 Media3 特效时使用。
提供让应用 UI 适配不同 Android 设备(手机、平板、折叠屏、笔记本、桌面、TV、Auto 和 XR)的说明。涵盖使用 Compose MediaQuery API 处理不同窗口尺寸、指针设备(如鼠标)和文本输入设备(如键盘);使用 Navigation3 Scenes 实现多窗格布局;使用 Compose Grid 和 FlexBox API 实现随目标尺寸变化的自适应 UI 组件(如按钮)和自适应布局(含导航区——nav rails 和 nav bars)。
提供将 Android XML View 迁移到 Jetpack Compose 的结构化工作流。该 skill 详述从规划和依赖设置,到主题和布局迁移、验证及 XML 清理的分步流程。当需要在 Android 项目中把 XML View 迁移到 Jetpack Compose 时使用。它解决将旧版 XML View 的 UI 转换为现代声明式 Compose 组件、同时保持互操作性的问题。
使用此 skill 将 Jetpack Compose Styles API 集成到 Android 项目。引导你升级依赖、设置组件主题、让自定义组件可样式化,以及将现有布局属性迁移到统一样式。迁移自定义设计系统组件、用 Style 属性替换硬编码参数、使用 Modifier.styleable 处理交互状态。
学习如何安装并迁移到 Jetpack Navigation 3,以及如何实现 deep links、多个 backstack、scenes(对话框、底部表、list-detail、two-pane、supporting pane)、条件导航(如已登录导航 vs 匿名导航)、从流程返回结果、与 Hilt/ViewModel/Kotlin/View 互操作集成等功能和模式。
帮助开发者集成、调试和解决 Play Engage SDK 实现问题。当添加 Engage SDK 支持、生成发布代码、将数据类映射到实体,或修复 SDK 相关错误时使用。
| name | verified-email |
| description | 提供基于 Android Credential Manager API 实现已验证邮箱获取的完整工作流。使用此 skill 向 Android 应用集成安全、免 OTP 的邮箱验证流程。该 skill 利用来自 Google 等可信提供商的加密验证凭证,解决注册流程摩擦过大的问题。 |
| license | Complete terms in LICENSE.txt |
| metadata | {"author":"Google LLC","last-updated":"2026-07-02","keywords":["implementation","Android","Credential Manager","Digital Credentials","Verified Email","OpenID4VP","SD-JWT","OTP-less","authentication","passkeys","CredMan","identity."]} |
dcql_query, UserInfoCredential, and GetDigitalCredentialOption.Email verification is applicable for the following use cases:
Crucial : This skill focuses exclusively on the Android client-side integration . It does not implement the app's server-side cryptographic validation logic. Server-side validation of the returned credential is required for security and must be implemented in your backend.
Get started with the following queries in project source code to find relevant screens with different use cases to implement verified email:
SignUpScreen"Email address""Recover Account""Account Recovery""Forgot password?""Delete Account"To implement this feature effectively, you must first locate the relevant flows in your codebase. To initiate, start with the following strategies to cater to different use cases using verified email:
If your app uses Navigation, search for routes or destinations related to authentication:
Look for:
signup, registration, create_account, forgot_password, recovery, verify_email.NavHost or composable destinations using these strings.Find the business logic handling user attributes and account creation, account recovery:
SignUpViewModel, AuthViewModel, RegistrationRepository.onCreateAccount, onRecoverAccount, or validateEmail.For reauthentication use cases, find areas where users perform sensitive actions:
ChangePassword, UpdatePayment, DeleteAccount, UpdateDetails, EditUserDetailsSdJwtParser to parse raw SD-JWT and return a JSONObject.VerifiedUserInfo data class to store the parsed name and email.This guide describes how to implement verified email retrieval using the Digital Credentials Verifier API through an OpenID for Verifiable Presentations (OpenID4VP) request.
In your app's build.gradle file, add the following dependencies for Credential
Manager:
dependencies {
implementation("androidx.credentials:credentials:1.7.0-alpha02")
implementation("androidx.credentials:credentials-play-services-auth:1.7.0-alpha02")
}
dependencies {
implementation "androidx.credentials:credentials:1.7.0-alpha02"
implementation "androidx.credentials:credentials-play-services-auth:1.7.0-alpha02"
}
Use your app or activity context to create a CredentialManager object.
// Use your app or activity context to instantiate a client instance of
// CredentialManager.
private val credentialManager = CredentialManager.create(context)
To request a verified email, construct a GetCredentialRequest
containing a GetDigitalCredentialOption. This option requires a
requestJson string formatted as an OpenID for Verifiable Presentations
(OpenID4VP) request.
The OpenID4VP request JSON must follow a specific structure. The current
providers support a JSON structure with an outer "digital": {"requests": [...]} wrapper.
val nonce = generateSecureRandomNonce()
// This request follows the OpenID4VP spec
val openId4vpRequest = """
{
"requests": [
{
"protocol": "openid4vp-v1-unsigned",
"data": {
"response_type": "vp_token",
"response_mode": "dc_api",
"nonce": "$nonce",
"dcql_query": {
"credentials": [
{
"id": "user_info_query",
"format": "dc+sd-jwt",
"meta": {
"vct_values": ["UserInfoCredential"]
},
"claims": [
{"path": ["email"]},
{"path": ["name"]},
{"path": ["given_name"]},
{"path": ["family_name"]},
{"path": ["picture"]},
{"path": ["hd"]},
{"path": ["email_verified"]}
]
}
]
}
}
}
]
}
"""
val getDigitalCredentialOption = GetDigitalCredentialOption(requestJson = openId4vpRequest)
val request = GetCredentialRequest(listOf(getDigitalCredentialOption))
The request contains the following key information:
DCQL query : The dcql_query specifies the credential type and the
claims being requested (email_verified). You can request other claims to
determine the level of verification. A few possible claims are as follows:
email_verified: In the response, this is a Boolean that indicates whether the email is verified.hd (hosted domain): In the response, this is empty.[!NOTE] Note: If
email_verifiedistrueandhdis empty in the response, it implies that the account is an authorized Google Account. Google does not issue verifiable credentials for Google Workspace Accounts. However, thehdfield is present in verifiable credentials issued for non-workspace accounts. You are encouraged to implement handling this field to future-proof your app. If the email is non-@gmail.com, Google verified this email when the Google Account was created, but there is no freshness claim. Therefore, for non-Google emails, you should consider an additional challenge, such as an OTP, to verify the user. To understand the schema of the credential and the specific rules for validating fields likeemail_verified, refer to the Google Identity guides.
nonce: A unique, cryptographically secure random value is generated for each request. This is critical for security, as it prevents replay attacks.
UserInfoCredential: This value implies a specific type of digital
credential that contains user attributes. Including this in the request is
pivotal to distinguish the email verification use case.
Next, wrap the openId4vpRequest JSON in a GetDigitalCredentialOption, create
a GetCredentialRequest, and call getCredential().
[!NOTE] Note: The
hdandemail_verifiedfields are hidden from users in Credential Manager's built-in UI. You cannot make a request with only these hidden fields- in case of such requests, the response is theGetCredentialCancellationException.
Present the user with the request, using the Credential Manager built-in UI.
try {
// Requesting Digital Credential from user...
val result = credentialManager.getCredential(activity, request)
when (val credential = result.credential) {
is DigitalCredential -> {
val responseJsonString = credential.credentialJson
// Successfully received digital credential response.
// Next, parse this response and send it to your server.
// ...
}
else -> {
// handle Unexpected State() - Up to the developer
}
}
} catch (e: Exception) {
// handle exceptions - Up to the developer
}
[!NOTE] Note: There is no equivalent of Sign in with Google's
preferImmediatelyAvailableCredentialsfor Digital Credentials. If no verifiable credential is found (for example, no eligible account on device), the user will be shown a "No options available" or similar system screen.
After receiving the response, you can perform a preliminary parse on the client. This is useful for immediately updating the UI, for example, by showing the user's name.
[!IMPORTANT] Important: This step is not for validation. Full cryptographic verification must be performed on your server.
The following code extracts the raw Selective Disclosure JWT (SD-JWT) and uses a helper to decode its claims.
// 1. Parse the outer JSON wrapper to get the `vp_token`
val responseData = JSONObject(responseJsonString)
val vpToken = responseData.getJSONObject("vp_token")
// 2. Extract the raw SD-JWT string
val credentialId = vpToken.keys().next()
val rawSdJwt = vpToken.getJSONArray(credentialId).getString(0)
// 3. Use your parser to get the verified claims
// Server-side validation/parsing is highly recommended.
// Assumes a local parser like the one in our SdJwtParser.kt sample
val claims = SdJwtParser.parse(rawSdJwt)
Log.d("TAG", "Parsed Claims: ${claims.toString(2)}")
// 4. Create your VerifiedUserInfo object with REAL data
val userInfo = VerifiedUserInfo(
email = claims.getString("email"),
displayName = claims.optString("name", claims.getString("email"))
)
The Credential Manager API will return a DigitalCredential
response.
The following is an example of what the raw responseJsonString looks like, and
what the claims look like after parsing the inner SD-JWT where you get
additional metadata as well along with verified email:
/*
// Example of the raw JSON response from credential.credentialJson:
{
"vp_token": {
// This key matches the 'id' you set in your dcql_query
"user_info_query": [
// The SD-JWT string (Issuer JWT ~ Disclosures ~ Key Binding JWT)
"eyJhbGciOiJ...~WyI...IiwgImVtYWlsIiwgInVzZXJAZXhhbXBsZS5jb20iXQ~...~eyJhbGciOiJ..."
]
}
}
// Example of the parsed and verified claims from the SD-JWT on your server:
{
"cnf": {
"jwk": {..}
},
"exp": 1775688222,
"iat": 1775083422,
"iss": "https://verifiablecredentials-pa.googleapis.com",
"vct": "UserInfoCredential",
"email": "jane.doe.246745@gmail.com",
"email_verified": true,
"given_name": "Jane",
"family_name": "Doe",
"name": "Jane Doe",
"picture": "http://example.com/janedoe/me.jpg",
"hd": ""
}
*/
[!IMPORTANT] Important: We highly recommend that after receiving the verified email, you trigger Credential Manager's passkey creation.
Since the retrieved email is cryptographically verified, you can omit the email
OTP verification step, significantly reducing sign-up friction and potentially
increasing conversion. This process is best handled on your server. The client
sends the raw response (containing the vp_token) and the original nonce to a
new server endpoint.
For verification, your application must send the full responseJsonString to
your server for cryptographic validation before creating an account or logging
the user in.
The digital credential provides two critical levels of verification for your server:
iss) URL and the SD-JWT signature proves that a trusted authority issued this data.cnf field and the Key Binding (kb) signature confirms that the credential is being shared by the same device it was originally issued to, preventing it from being intercepted or used on another device.The validation on the server must achieve the following:
iss (issuer) field matches https://verifiablecredentials-pa.googleapis.com.[!NOTE] Note: Use a standard library (such as @sd-jwt/sd-jwt-vc for Node.js) to perform the verification steps as outlined in the OpenID for Verifiable Presentations specification.
For full security, make sure that you also validate the nonce to prevent
replay attacks.
By combining these steps, your server can validate both the authenticity of the data and the identity of the presenter, ensuring the credential wasn't intercepted or spoofed before provisioning the new account.
try {
// Send the raw credential response and the original nonce to your server.
// Your server must validate the response. createAccountWithVerifiedCredentials
// is a custom implementation per each RP for server side verification and account creation.
val serverResponse = createAccountWithVerifiedCredentials(responseJsonString, nonce)
// Server returns the new account info (e.g., email, name)
val claims = JSONObject(serverResponse.json)
val userInfo = VerifiedUserInfo(
email = claims.getString("email"),
displayName = claims.optString("name", claims.getString("email"))
)
// handle response - Up to the developer
} catch (e: Exception) {
// handle exceptions - Up to the developer
}
An optional but highly recommended next step after provisioning an account is to immediately create a passkey for that account. This provides a secure, passwordless method for the user to sign in. This flow is identical to a standard passkey registration.
For the flow to work on a WebView, developers should implement a
JavaScript bridge (JS Bridge) to facilitate the handoff. This bridge
allows the WebView object to signal the native app, which can then perform the
actual call to the Credential Manager API.
To maintain the integrity of the email verification flow, the following security requirements are mandatory:
responseJsonString and the original nonce to the app's server for full verification.iss) field, the SD-JWT signature, and the presenter identity using the cnf field.