SaveAccountLinkingTokenRequest.Builder
Stay organized with collections
Save and categorize content based on your preferences.
Public Constructor Summary
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Methods
Sets the (mandatory) PendingIntent
that can be launched by Google Play services to show the consent page during the flow.
When the launched Activity is finished, it has to provide the appropriate data in the
result that it returns to the caller, based on the following contract:
- If the user has accepted the consent, the launched Activity must call
setResult
with RESULT_OK
,
along with a token as a (string) intent extra in the result, with the key
SaveAccountLinkingTokenRequest.EXTRA_TOKEN
, similar to the following
snippet:
Intent intent = new Intent();
intent.putExtra(SaveAccountLinkingTokenRequest.EXTRA_TOKEN, token);
setResult(Activity.RESULT_OK, intent);
finish();
- If, however, the user has rejected the consent, the Activity has to call
setResult
with RESULT_CANCELED
.
Sets the list of scopes that are associated with the token that will be saved to
Google. Calling this method with the correct scope(s) is required.
Sets the service-id that can be obtained from your Google Cloud project. Calling
this method to set serviceId
is required.
Sets the type of token that will be saved to Google. Valid options are:
Calling this method with a valid token type is required.
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 2024-10-31 UTC.
[null,null,["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eSaveAccountLinkingTokenRequest.Builder\u003c/code\u003e facilitates the creation of \u003ccode\u003eSaveAccountLinkingTokenRequest\u003c/code\u003e objects for securely saving account linking tokens.\u003c/p\u003e\n"],["\u003cp\u003eIt mandates specifying a \u003ccode\u003ePendingIntent\u003c/code\u003e for user consent, a service ID from your Google Cloud project, and the token type (e.g., auth code).\u003c/p\u003e\n"],["\u003cp\u003eIt requires defining the list of scopes associated with the token being saved for access control.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebuild()\u003c/code\u003e method finalizes the request object construction based on provided parameters.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers need to handle user consent within the launched activity, returning either an authorization token or a cancellation signal.\u003c/p\u003e\n"]]],["The `SaveAccountLinkingTokenRequest.Builder` class facilitates creating a request to save an account linking token. Key actions include: calling the builder to `build` the request, using `setConsentPendingIntent` to specify the PendingIntent for the consent page, `setScopes` to define token-associated scopes, `setServiceId` with a Google Cloud project ID, and `setTokenType` for token type identification. It also handles user consent results: `RESULT_OK` with a token, or `RESULT_CANCELED` for rejection.\n"],null,["# SaveAccountLinkingTokenRequest.Builder\n\npublic static final class **SaveAccountLinkingTokenRequest.Builder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nBuilder for [SaveAccountLinkingTokenRequest](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest). \n\n### Public Constructor Summary\n\n|---|---------------------------------------------------------------------------------------------------------------------------|\n| | [Builder](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder#Builder())() |\n\n### Public Method Summary\n\n|----------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [SaveAccountLinkingTokenRequest](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest) | [build](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder#build())() Builds an immutable instance of the [SaveAccountLinkingTokenRequest](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest). |\n| [SaveAccountLinkingTokenRequest.Builder](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder) | [setConsentPendingIntent](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder#setConsentPendingIntent(android.app.PendingIntent))([PendingIntent](//developer.android.com/reference/android/app/PendingIntent.html) consentPendingIntent) Sets the (mandatory) [PendingIntent](//developer.android.com/reference/android/app/PendingIntent.html) that can be launched by Google Play services to show the consent page during the flow. |\n| [SaveAccountLinkingTokenRequest.Builder](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder) | [setScopes](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder#setScopes(java.util.List\u003cjava.lang.String\u003e))([List](//developer.android.com/reference/java/util/List.html)\\\u003c[String](//developer.android.com/reference/java/lang/String.html)\\\u003e scopes) Sets the list of scopes that are associated with the token that will be saved to Google. |\n| [SaveAccountLinkingTokenRequest.Builder](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder) | [setServiceId](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder#setServiceId(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) serviceId) Sets the service-id that can be obtained from your Google Cloud project. |\n| [SaveAccountLinkingTokenRequest.Builder](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder) | [setTokenType](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder#setTokenType(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) tokenType) Sets the type of token that will be saved to Google. |\n\n### Inherited Method Summary\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 **Builder** ()\n\nPublic Methods\n--------------\n\n#### public [SaveAccountLinkingTokenRequest](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest) **build** ()\n\nBuilds an immutable instance of the [SaveAccountLinkingTokenRequest](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest). \n\n#### public [SaveAccountLinkingTokenRequest.Builder](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder) **setConsentPendingIntent** ([PendingIntent](//developer.android.com/reference/android/app/PendingIntent.html) consentPendingIntent)\n\nSets the (mandatory) [PendingIntent](//developer.android.com/reference/android/app/PendingIntent.html)\nthat can be launched by Google Play services to show the consent page during the flow.\nWhen the launched Activity is finished, it has to provide the appropriate data in the\nresult that it returns to the caller, based on the following contract:\n\n- If the user has accepted the consent, the launched Activity must call `setResult` with [RESULT_OK](//developer.android.com/reference/android/app/Activity.html#RESULT_OK), along with a token as a (string) intent extra in the result, with the key [SaveAccountLinkingTokenRequest.EXTRA_TOKEN](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest#EXTRA_TOKEN), similar to the following snippet: \n\n Intent intent = new Intent();\n intent.putExtra(SaveAccountLinkingTokenRequest.EXTRA_TOKEN, token);\n setResult(Activity.RESULT_OK, intent);\n finish();\n\n \n- If, however, the user has rejected the consent, the Activity has to call `setResult` with [RESULT_CANCELED](//developer.android.com/reference/android/app/Activity.html#RESULT_CANCELED). \n\n#### public [SaveAccountLinkingTokenRequest.Builder](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder) **setScopes** ([List](//developer.android.com/reference/java/util/List.html)\\\u003c[String](//developer.android.com/reference/java/lang/String.html)\\\u003e scopes)\n\nSets the list of scopes that are associated with the token that will be saved to\nGoogle. Calling this method with the correct scope(s) is required. \n\n#### public [SaveAccountLinkingTokenRequest.Builder](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder) **setServiceId** ([String](//developer.android.com/reference/java/lang/String.html) serviceId)\n\nSets the service-id that can be obtained from your Google Cloud project. Calling\nthis method to set `serviceId` is required. \n\n#### public [SaveAccountLinkingTokenRequest.Builder](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest.Builder) **setTokenType** ([String](//developer.android.com/reference/java/lang/String.html) tokenType)\n\nSets the type of token that will be saved to Google. Valid options are:\n\n- [SaveAccountLinkingTokenRequest.TOKEN_TYPE_AUTH_CODE](/android/reference/com/google/android/gms/auth/api/identity/SaveAccountLinkingTokenRequest#TOKEN_TYPE_AUTH_CODE)\nCalling this method with a valid token type is required."]]