> ## Documentation Index
> Fetch the complete documentation index at: https://docs.streamnative.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Access Cloud API using OAuth 2.0

Use the following information to configure your applications to use the OAuth2 authentication mechanism for connecting to StreamNative Cloud API.

## Configure StreamNative CLI

### Use StreamNative CLI as a user account

You can follow the [instructions](/cloud/security/access/resource-hierarchy/organizations#sign-in-to-an-organization) in [Organizations in StreamNative Cloud](/cloud/security/access/resource-hierarchy/organizations) to sign in to an organization as a user account to use StreamNative CLI.

### Use StreamNative CLI as a service account

In order to use StreamNative CLI as a service account, you need to download a credentials file for the service account you want to use. Please follow the [instructions](/cloud/security/authentication/service-accounts/use-oauth/configure-pulsar-clients-with-oauth-20#credentials-file) in [Access Cloud Clusters](/cloud/security/authentication/service-accounts/use-oauth/configure-pulsar-clients-with-oauth-20) to download the credentials file. We assume that the download credentials file is saved in `/path/to/credentials.json`.

Once you have the credentials file, you can activate the service account by running the following command:

```bash theme={null}
snctl auth activate-service-account --key-file /path/to/credentials.json
```

If the service account is successfully activated, you will see a similar message below in your terminal running the command.

```bash theme={null}
Logged in as sa@my_org.auth.streamnative.cloud.
Welcome to StreamNative Cloud!
```

You can also run `snctl auth whoami` to check which service account that `snctl` is using. It will return the princial name of this service account. Example message is shown below:

```bash theme={null}
sa@my_org.auth.streamnative.cloud
```
