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::UserRefreshCredentials.

Authenticates requests using User Refresh credentials.


This class allows authorizing requests from user refresh tokens.

This the end of the result of a 3LO flow. E.g, the end result of
'gcloud auth login' saves a file with these contents in well known
location

<br />

cf [Application Default Credentials](https://cloud.google.com/docs/authentication/production)

## Inherits

- [Signet::OAuth2::Client](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Signet-OAuth2-Client.md.txt)

## Extended By

- [Google::Auth::CredentialsLoader](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-CredentialsLoader.md.txt)

## Methods

### .make_creds

```ruby
def self.make_creds(options = {})
```
Create a UserRefreshCredentials.
**Parameters**

- **json_key_io** (IO) --- An IO object containing the JSON key
- **scope** (string\|array\|nil) --- the scope(s) to access

### .read_json_key

```ruby
def self.read_json_key(json_key_io) -> Hash
```
Reads a JSON key from an IO object and extracts required fields.
**Parameter**

- **json_key_io** (IO) --- An IO object containing the JSON key
**Returns**

- (Hash) --- The parsed JSON key
**Raises**

- ([Google::Auth::InitializationError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-InitializationError.md.txt)) --- If the JSON is missing required fields

### #duplicate

```ruby
def duplicate(options = {})
```
Creates a duplicate of these credentials
without the Signet::OAuth2::Client-specific
transient state (e.g. cached tokens)
**Parameter**

- **options** (Hash) ---

  Overrides for the credentials parameters.
  The following keys are recognized in addition to keys in the
  Signet::OAuth2::Client
  - `project_id` the project id to use during the authentication
  - `quota_project_id` the quota project id to use during the authentication

### #includes_scope?

```ruby
def includes_scope?(required_scope) -> Boolean
```
Verifies that a credential grants the requested scope
**Parameter**

- **required_scope** (Array\<String\>, String) --- Scope to verify
**Returns**

- (Boolean) --- True if scope is granted

### #initialize

```ruby
def initialize(options = {}) -> UserRefreshCredentials
```
**Returns**

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

### #project_id

```ruby
def project_id()
```
Returns the value of attribute project_id.

### #quota_project_id

```ruby
def quota_project_id()
```
Returns the value of attribute quota_project_id.

### #revoke!

```ruby
def revoke!(options = {})
```
Revokes the credential
**Parameter**

- **options** (Hash) --- Options for revoking the credential
**Raises**

- ([Google::Auth::AuthorizationError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-AuthorizationError.md.txt)) --- If the revocation request fails

### #update!

```ruby
def update!(options = {}) -> Google::Auth::UserRefreshCredentials
```
Destructively updates these credentials


<br />

This method is called by `Signet::OAuth2::Client`'s constructor
**Parameter**

- **options** (Hash) ---

  Overrides for the credentials parameters.
  The following keys are recognized in addition to keys in the
  Signet::OAuth2::Client
  - `project_id` the project id to use during the authentication
  - `quota_project_id` the quota project id to use during the authentication
**Returns**

- ([Google::Auth::UserRefreshCredentials](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-UserRefreshCredentials.md.txt))

## Constants

### TOKEN_CRED_URI

**value:** "<https://oauth2.googleapis.com/token".freeze>

### AUTHORIZATION_URI

**value:** "<https://accounts.google.com/o/oauth2/auth".freeze>

### REVOKE_TOKEN_URI

**value:** "<https://oauth2.googleapis.com/revoke".freeze>