---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [clients](../index.md) / withScopes

# Function: withScopes()

> **withScopes**(`auth`, `additionalScopes`): [`AuthStrategy`](../../auth/interfaces/AuthStrategy.md)

Defined in: [packages/b2c-tooling-sdk/src/clients/scapi-backend-utils.ts:66](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/2feab01f654eec77c6d702777ec2818472f131f1/packages/b2c-tooling-sdk/src/clients/scapi-backend-utils.ts#L66)

Returns a copy of `auth` with `additionalScopes` merged in, or the original
`auth` if the strategy doesn't support scope merging (e.g., basic/api-key
auth, or a stored-session strategy where scopes were fixed at acquisition).

Centralized so SCAPI client factories don't have to keep extending an
`instanceof` chain as new OAuth strategy types are added.

## Parameters

### auth

[`AuthStrategy`](../../auth/interfaces/AuthStrategy.md)

### additionalScopes

`string`[]

## Returns

[`AuthStrategy`](../../auth/interfaces/AuthStrategy.md)
