# Cloud Pub/Sub API - Class Google::Cloud::PubSub::Credentials (v3.3.0)

3.3.0 (latest) 3.2.1 3.1.1 3.0.3 2.23.0 2.22.0 2.21.0 2.20.0 2.19.0 2.18.1 2.17.0 2.16.0 2.15.5 2.14.0 2.12.1 2.11.0 2.10.0 2.9.2 Reference documentation and code samples for the Cloud Pub/Sub API class Google::Cloud::PubSub::Credentials.

## Credentials

Represents the authentication and authorization used to connect to the
Pub/Sub API.

## Inherits

- Google::Cloud::PubSub::V1::Publisher::Credentials

## Example

```ruby
require "google/cloud/pubsub"

keyfile = "/path/to/keyfile.json"
creds = Google::Cloud::PubSub::Credentials.new keyfile

pubsub = Google::Cloud::PubSub.new(
  project_id: "my-project",
  credentials: creds
)

pubsub.project_id #=> "my-project"
```