Override CredentialsLoader#make_creds to use the class determined by
loading the json.
Important:If you accept a credential configuration (credential
JSON/File/Stream) from an external source for authentication to Google
Cloud, you must validate it before providing it to any Google API or
library. Providing an unvalidated credential configuration to Google
APIs can compromise the security of your systems and data. For more
information, refer toValidate credential configurations from external
sources.
Parameter
options(Hash) — Options for creating the credentials
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# googleauth - Class Google::Auth::DefaultCredentials (v1.15.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.15.0 (latest)](/ruby/docs/reference/googleauth/latest/Google-Auth-DefaultCredentials)\n- [1.14.0](/ruby/docs/reference/googleauth/1.14.0/Google-Auth-DefaultCredentials)\n- [1.13.1](/ruby/docs/reference/googleauth/1.13.1/Google-Auth-DefaultCredentials)\n- [1.12.2](/ruby/docs/reference/googleauth/1.12.2/Google-Auth-DefaultCredentials) \nReference documentation and code samples for the googleauth class Google::Auth::DefaultCredentials.\n\nDefaultCredentials is used to preload the credentials file, to determine\nwhich type of credentials should be loaded. \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- [Google::Auth::CredentialsLoader](./Google-Auth-CredentialsLoader)\n\nMethods\n-------\n\n### .determine_creds_class\n\n def self.determine_creds_class(json_key_io) -\u003e Array(Hash, Class)\n\nReads the input json and determines which creds class to use. \n**Parameter**\n\n- **json_key_io** (IO) --- An IO object containing the JSON key \n**Returns**\n\n- (Array(Hash, Class)) --- The JSON key and the credential class to use \n**Raises**\n\n- ([Google::Auth::InitializationError](./Google-Auth-InitializationError)) --- If the JSON is missing the type field or has an unsupported type\n\n### .make_creds\n\n def self.make_creds(options = {}) -\u003e Google::Auth::Credentials\n\nOverride CredentialsLoader#make_creds to use the class determined by\nloading the json.\n\n\n\u003cbr /\u003e\n\n**Important:** If you accept a credential configuration (credential\nJSON/File/Stream) from an external source for authentication to Google\nCloud, you must validate it before providing it to any Google API or\nlibrary. Providing an unvalidated credential configuration to Google\nAPIs can compromise the security of your systems and data. For more\ninformation, refer to [Validate credential configurations from external\nsources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). \n**Parameter**\n\n- **options** (Hash) --- Options for creating the credentials \n**Returns**\n\n- ([Google::Auth::Credentials](./Google-Auth-Credentials)) --- The credentials instance \n**Raises**\n\n- ([Google::Auth::InitializationError](./Google-Auth-InitializationError)) --- If the credentials cannot be determined\n\n### .read_creds\n\n def self.read_creds() -\u003e Class\n\nReads the credential type from environment and returns the appropriate class \n**Returns**\n\n- (Class) --- The credential class to use \n**Raises**\n\n- ([Google::Auth::InitializationError](./Google-Auth-InitializationError)) --- If the credentials type is undefined or unsupported"]]