U2fApiClient
Stay organized with collections
Save and categorize content based on your preferences.
This class is deprecated.
Please use Fido
APIs instead.
The entry point for interacting with the regular app U2F APIs.
U2F (Universal Second Factor) is the name of the Security Key protocol in FIDO (Fast
IDentity Online), which is the industry alliance where Security Keys are being
standardized.
Public Constructor Summary
Inherited Method Summary
From class com.google.android.gms.common.api.GoogleApi
getApiFallbackAttributionTag
( Context
arg0)
From class java.lang.Object
Public Constructors
public
U2fApiClient
( Activity
activity)
public
U2fApiClient
( Context
context)
Parameters
context
The Context
of the calling application
Public Methods
Creates a Task with U2fPendingIntent
.
When this Task object starts, it issues a U2F registration request, which is done once
per U2F device per account for associating the new U2F device with that account. For
example:
Task result = mU2fApiClient.getRegisterIntent(registerRequestParams);
...
result.addOnSuccessListener(
new OnSuccessListener() {
@Override
public void onSuccess(U2fPendingIntent u2fPendingIntent) {
if (u2fPendingIntent.hasPendingIntent()) {
// Start a U2F registration request.
u2fPendingIntent.launchPendingIntent(this, REGISTER_REQUEST_CODE);
}
}
});
result.addOnFailureListener(
new OnFailureListener() {
@Override
public void onFailure(Exception e) {
// Fail
}
}
Parameters
requestParams
for the registration request
Returns
- Task with PendingIntent to launch U2F registration request
Creates a Task with U2fPendingIntent
.
When this Task object starts, it issues a U2F signing request for a relying party to
authenticate a user. For example:
Task result = mU2fApiClient.getSignIntent(registerRequestParams);
...
result.addOnSuccessListener(
new OnSuccessListener() {
@Override
public void onSuccess(U2fPendingIntent u2fPendingIntent) {
if (u2fPendingIntent.hasPendingIntent()) {
// Start a U2F sign request.
u2fPendingIntent.launchPendingIntent(this, SIGN_REQUEST_CODE);
}
}
});
result.addOnFailureListener(
new OnFailureListener() {
@Override
public void onFailure(Exception e) {
// Fail
}
}
Parameters
requestParams
for the sign request
Returns
- Task with PendingIntent to launch U2F signature request
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-04-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-07 UTC."],[[["\u003cp\u003e\u003ccode\u003eU2fApiClient\u003c/code\u003e is deprecated and developers should use the \u003ccode\u003eFido\u003c/code\u003e APIs instead for Security Key operations.\u003c/p\u003e\n"],["\u003cp\u003eIt served as an entry point for interacting with the U2F (Universal Second Factor) protocol, part of the FIDO standard.\u003c/p\u003e\n"],["\u003cp\u003eIt provided methods to initiate U2F registration (\u003ccode\u003egetRegisterIntent\u003c/code\u003e) and signing (\u003ccode\u003egetSignIntent\u003c/code\u003e) requests with Security Keys.\u003c/p\u003e\n"],["\u003cp\u003eThese requests utilized \u003ccode\u003eU2fPendingIntent\u003c/code\u003e to launch the corresponding interactions with the Security Key.\u003c/p\u003e\n"]]],[],null,["# U2fApiClient\n\npublic class **U2fApiClient** extends [GoogleApi](/android/reference/com/google/android/gms/common/api/GoogleApi)\\\u003c[Api.ApiOptions.NoOptions](/android/reference/com/google/android/gms/common/api/Api.ApiOptions.NoOptions)\\\u003e \n**This class is deprecated.** \n\nPlease use [Fido](/android/reference/com/google/android/gms/fido/Fido) APIs instead.\n\nThe entry point for interacting with the regular app U2F APIs.\n\nU2F (Universal Second Factor) is the name of the Security Key protocol in FIDO (Fast\nIDentity Online), which is the industry alliance where Security Keys are being\nstandardized. \n\n##### See Also\n\n- \u003c//developers.google.com/identity/fido/android/native-apps\u003e \n\n### Public Constructor Summary\n\n|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [U2fApiClient](/android/reference/com/google/android/gms/fido/u2f/U2fApiClient#U2fApiClient(android.app.Activity))([Activity](//developer.android.com/reference/android/app/Activity.html) activity) |\n| | [U2fApiClient](/android/reference/com/google/android/gms/fido/u2f/U2fApiClient#U2fApiClient(android.content.Context))([Context](//developer.android.com/reference/android/content/Context.html) context) |\n\n### Public Method Summary\n\n|-------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Task\\\u003c[U2fPendingIntent](/android/reference/com/google/android/gms/fido/u2f/U2fPendingIntent)\\\u003e | [getRegisterIntent](/android/reference/com/google/android/gms/fido/u2f/U2fApiClient#getRegisterIntent(com.google.android.gms.fido.u2f.api.common.RegisterRequestParams))([RegisterRequestParams](/android/reference/com/google/android/gms/fido/u2f/api/common/RegisterRequestParams) requestParams) Creates a Task with [U2fPendingIntent](/android/reference/com/google/android/gms/fido/u2f/U2fPendingIntent). |\n| Task\\\u003c[U2fPendingIntent](/android/reference/com/google/android/gms/fido/u2f/U2fPendingIntent)\\\u003e | [getSignIntent](/android/reference/com/google/android/gms/fido/u2f/U2fApiClient#getSignIntent(com.google.android.gms.fido.u2f.api.common.SignRequestParams))([SignRequestParams](/android/reference/com/google/android/gms/fido/u2f/api/common/SignRequestParams) requestParams) Creates a Task with [U2fPendingIntent](/android/reference/com/google/android/gms/fido/u2f/U2fPendingIntent). |\n\n### Inherited Method Summary\n\nFrom class com.google.android.gms.common.api.GoogleApi \n\n|-------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|\n| [String](//developer.android.com/reference/java/lang/String.html) | getApiFallbackAttributionTag([Context](//developer.android.com/reference/android/content/Context.html) arg0) |\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public **U2fApiClient** ([Activity](//developer.android.com/reference/android/app/Activity.html) activity)\n\n##### Parameters\n\n| activity | Calling [Activity](//developer.android.com/reference/android/app/Activity.html) |\n|----------|---------------------------------------------------------------------------------|\n\n#### public **U2fApiClient** ([Context](//developer.android.com/reference/android/content/Context.html) context)\n\n##### Parameters\n\n| context | The [Context](//developer.android.com/reference/android/content/Context.html) of the calling application |\n|---------|----------------------------------------------------------------------------------------------------------|\n\nPublic Methods\n--------------\n\n#### public Task\\\u003c[U2fPendingIntent](/android/reference/com/google/android/gms/fido/u2f/U2fPendingIntent)\\\u003e\n**getRegisterIntent** ([RegisterRequestParams](/android/reference/com/google/android/gms/fido/u2f/api/common/RegisterRequestParams) requestParams)\n\nCreates a Task with [U2fPendingIntent](/android/reference/com/google/android/gms/fido/u2f/U2fPendingIntent).\nWhen this Task object starts, it issues a U2F registration request, which is done once\nper U2F device per account for associating the new U2F device with that account. For\nexample: \n\n\n Task result = mU2fApiClient.getRegisterIntent(registerRequestParams);\n ...\n result.addOnSuccessListener(\n new OnSuccessListener() {\n @Override\n public void onSuccess(U2fPendingIntent u2fPendingIntent) {\n if (u2fPendingIntent.hasPendingIntent()) {\n // Start a U2F registration request.\n u2fPendingIntent.launchPendingIntent(this, REGISTER_REQUEST_CODE);\n }\n }\n });\n result.addOnFailureListener(\n new OnFailureListener() {\n @Override\n public void onFailure(Exception e) {\n // Fail\n }\n }\n \n##### Parameters\n\n| requestParams | for the registration request |\n|---------------|------------------------------|\n\n##### Returns\n\n- Task with PendingIntent to launch U2F registration request \n\n#### public Task\\\u003c[U2fPendingIntent](/android/reference/com/google/android/gms/fido/u2f/U2fPendingIntent)\\\u003e\n**getSignIntent** ([SignRequestParams](/android/reference/com/google/android/gms/fido/u2f/api/common/SignRequestParams) requestParams)\n\nCreates a Task with [U2fPendingIntent](/android/reference/com/google/android/gms/fido/u2f/U2fPendingIntent).\nWhen this Task object starts, it issues a U2F signing request for a relying party to\nauthenticate a user. For example: \n\n\n Task result = mU2fApiClient.getSignIntent(registerRequestParams);\n ...\n result.addOnSuccessListener(\n new OnSuccessListener() {\n @Override\n public void onSuccess(U2fPendingIntent u2fPendingIntent) {\n if (u2fPendingIntent.hasPendingIntent()) {\n // Start a U2F sign request.\n u2fPendingIntent.launchPendingIntent(this, SIGN_REQUEST_CODE);\n }\n }\n });\n result.addOnFailureListener(\n new OnFailureListener() {\n @Override\n public void onFailure(Exception e) {\n // Fail\n }\n }\n \n##### Parameters\n\n| requestParams | for the sign request |\n|---------------|----------------------|\n\n##### Returns\n\n- Task with PendingIntent to launch U2F signature request"]]