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

# cloudstic auth new

> Create or update a reusable cloud auth entry

Create or update a named auth entry for cloud source authentication (Google Drive or OneDrive). Auth entries store OAuth token file paths and optional credentials, and can be shared across multiple profiles.

## Usage

```bash theme={null}
cloudstic auth new [options]
```

## Options

<ParamField path="-name" type="string" required>
  Auth reference name.
</ParamField>

<ParamField path="-provider" type="string" required>
  Cloud provider: `google` or `onedrive`.
</ParamField>

### Google Options

<ParamField path="-google-credentials" type="string">
  Path to Google service account credentials JSON file. Optional. If not provided, Cloudstic uses the built-in OAuth flow.
</ParamField>

<ParamField path="-google-token-file" type="string">
  Path to Google OAuth token file. If not provided, defaults to `~/.config/cloudstic/tokens/google-<name>_token.json`.
</ParamField>

### OneDrive Options

<ParamField path="-onedrive-client-id" type="string">
  OneDrive OAuth client ID. Optional. If not provided, Cloudstic uses built-in credentials.
</ParamField>

<ParamField path="-onedrive-token-file" type="string">
  Path to OneDrive OAuth token file. If not provided, defaults to `~/.config/cloudstic/tokens/onedrive-<name>_token.json`.
</ParamField>

### General Options

<ParamField path="-profiles-file" type="string" env="CLOUDSTIC_PROFILES_FILE">
  Path to the profiles YAML file.
</ParamField>

## Examples

<CodeGroup>
  ```bash Google Drive Auth theme={null}
  cloudstic auth new \
    -name google-main \
    -provider google
  ```

  ```bash Google Drive with Service Account theme={null}
  cloudstic auth new \
    -name google-sa \
    -provider google \
    -google-credentials /path/to/service-account.json
  ```

  ```bash OneDrive Auth theme={null}
  cloudstic auth new \
    -name onedrive-personal \
    -provider onedrive
  ```

  ```bash OneDrive with Custom Client theme={null}
  cloudstic auth new \
    -name onedrive-custom \
    -provider onedrive \
    -onedrive-client-id "your-app-client-id"
  ```
</CodeGroup>

## After Creating an Auth Entry

Run the OAuth login flow to obtain a token:

```bash theme={null}
cloudstic auth login -name google-main
```

This opens your browser for authorization and saves the token to the configured file.

## See Also

* [cloudstic auth login](/commands/auth-login): Run the OAuth login flow
* [cloudstic auth list](/commands/auth-list): List auth entries
* [cloudstic auth show](/commands/auth-show): Show auth entry details
* [Using Profiles](/guides/profiles): Complete profiles guide
