1.17.8 (latest) 1.17.7 1.16.2 1.15.1 1.14.0 1.13.1 1.12.2 Reference documentation and code samples for the googleauth class Google::Auth::ClientId.

Representation of an application's identity for user authorization flows.

## Inherits

- Object

## Methods

### .default

```ruby
def self.default()
```
Returns the value of attribute default.

### .default=

```ruby
def self.default=(value)
```
Sets the attribute default

### .from_file

```ruby
def self.from_file(file) -> Google::Auth::ClientID
```
Constructs a Client ID from a JSON file downloaded from the
Google Developers Console.
**Parameter**

- **file** (String, File) --- Path of file to read from
**Returns**

- (Google::Auth::ClientID)
**Raises**

- ([Google::Auth::InitializationError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-InitializationError.md.txt)) --- If file is nil

### .from_hash

```ruby
def self.from_hash(config) -> Google::Auth::ClientID
```
Constructs a Client ID from a previously loaded JSON file. The hash
structure should match the expected JSON format.
**Parameter**

- **config** (hash) --- Parsed contents of the JSON file
**Returns**

- (Google::Auth::ClientID)
**Raises**

- ([Google::Auth::InitializationError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-InitializationError.md.txt)) --- If config is nil or missing required elements

### #id

```ruby
def id() -> String
```
Text identifier of the client ID
**Returns**

- (String)

### #initialize

```ruby
def initialize(id, secret) -> ClientId
```
Initialize the Client ID. Both id and secret must be non-nil.
**Parameters**

- **id** (String) --- Text identifier of the client ID
- **secret** (String) --- Secret associated with the client ID
**Returns**

- ([ClientId](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-ClientId.md.txt)) --- a new instance of ClientId
**Raises**

- ([Google::Auth::InitializationError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-InitializationError.md.txt)) --- If id or secret is nil

### #secret

```ruby
def secret() -> String
```
Secret associated with the client ID
**Returns**

- (String)

## Constants

### INSTALLED_APP

**value:** "installed".freeze  
Toplevel JSON key for the an installed app configuration.
Must include client_id and client_secret subkeys if present.

### WEB_APP

**value:** "web".freeze  
Toplevel JSON key for the a webapp configuration.
Must include client_id and client_secret subkeys if present.

### CLIENT_ID

**value:** "client_id".freeze  
JSON key for the client ID within an app configuration.

### CLIENT_SECRET

**value:** "client_secret".freeze  
JSON key for the client secret within an app configuration.

### MISSING_TOP_LEVEL_ELEMENT_ERROR

**value:** "Expected top level property 'installed' or 'web' to be present.".freeze  
An error message raised when none of the expected toplevel properties
can be found.