Stay organized with collections
Save and categorize content based on your preferences.
public interface HasApiKey<O extends Api.ApiOptions>
Known indirect subclasses
Anything that has an ApiKey
.
This is used to allow GoogleApi
-based clients to be exposed via interface instead of subclass. Those interfaces can be declared as extending this, and GoogleApi
's will automatically fulfill the interface.
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-03-17 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-03-17 UTC."],[[["\u003cp\u003e\u003ccode\u003eHasApiKey\u003c/code\u003e is an interface used for objects possessing an API key.\u003c/p\u003e\n"],["\u003cp\u003eIt allows GoogleApi-based clients to be exposed as interfaces instead of subclasses, promoting flexibility in implementation.\u003c/p\u003e\n"],["\u003cp\u003eInterfaces extending \u003ccode\u003eHasApiKey\u003c/code\u003e can be automatically fulfilled by \u003ccode\u003eGoogleApi\u003c/code\u003e instances.\u003c/p\u003e\n"],["\u003cp\u003eThe key purpose is to manage API keys within Google API interactions.\u003c/p\u003e\n"]]],["`HasApiKey` is an interface in both Kotlin and Java. It serves as a marker for objects possessing an `ApiKey`. `GoogleApi`, the base class for Google API entry points, and `ModuleInstallClient`, an interface for module installation APIs, are direct subclasses. This interface enables `GoogleApi`-based clients to be exposed via interfaces instead of subclasses, allowing these interfaces to extend `HasApiKey`, which `GoogleApi` automatically fulfills.\n"],null,["HasApiKey \n[Kotlin](/android/reference/kotlin/com/google/android/gms/common/api/HasApiKey \"View this page in Kotlin\") \\|Java \n\n\n```\npublic interface HasApiKey\u003cO extends Api.ApiOptions\u003e\n```\n\n\u003cbr /\u003e\n\nKnown direct subclasses \n[AuthorizationClient](/android/reference/com/google/android/gms/auth/api/identity/AuthorizationClient), [CredentialSavingClient](/android/reference/com/google/android/gms/auth/api/identity/CredentialSavingClient), [GoogleApi](/android/reference/com/google/android/gms/common/api/GoogleApi), [ModuleInstallClient](/android/reference/com/google/android/gms/common/moduleinstall/ModuleInstallClient), [SignInClient](/android/reference/com/google/android/gms/auth/api/identity/SignInClient) \n\n|--------------------------------------------------------------------------------------------------------------|-----------------------------------------|\n| [AuthorizationClient](/android/reference/com/google/android/gms/auth/api/identity/AuthorizationClient) | A client for the authorization API. |\n| [CredentialSavingClient](/android/reference/com/google/android/gms/auth/api/identity/CredentialSavingClient) | A client for the Credential Saving API. |\n| [GoogleApi](/android/reference/com/google/android/gms/common/api/GoogleApi) | Base class for Google API entry points. |\n| [ModuleInstallClient](/android/reference/com/google/android/gms/common/moduleinstall/ModuleInstallClient) | Interface for module install APIs. |\n| [SignInClient](/android/reference/com/google/android/gms/auth/api/identity/SignInClient) | A client for the sign-in API. |\n\nKnown indirect subclasses \n[GoogleSignInClient](/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInClient) \n\n|----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [GoogleSignInClient](/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInClient) | **This class is deprecated.** Use [Credential Manager](https://developer.android.com/training/sign-in/credential-manager) for authentication or [Google Identity Services](https://developers.google.com/identity/sign-in/android/authorize-access) for authorization. \u003cbr /\u003e |\n\n*** ** * ** ***\n\nAnything that has an `ApiKey`.\n\nThis is used to allow [GoogleApi](/android/reference/com/google/android/gms/common/api/GoogleApi)-based clients to be exposed via interface instead of subclass. Those interfaces can be declared as extending this, and [GoogleApi](/android/reference/com/google/android/gms/common/api/GoogleApi)'s will automatically fulfill the interface."]]