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

[@salesforce/b2c-tooling-sdk](../../modules.md) / [auth](../index.md) / readPkceAuthorizationResponse

# Function: readPkceAuthorizationResponse()

> **readPkceAuthorizationResponse**(`redirect`, `request`): `string`

Defined in: [packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts:243](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/d7ff38c7ca2b1411cd718b9554500c9416f00266/packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts#L243)

Read the authorization code from an Account Manager redirect.

Checks that the redirect targets `request.redirectUri` and echoes
`request.state`, and turns an OAuth `error` parameter into an error
([PkceGrantUnsupportedError](../classes/PkceGrantUnsupportedError.md) when the client can't use the code grant).

## Parameters

### redirect

`string` | `URL`

### request

`Pick`\<[`PkceAuthorizeRequest`](../interfaces/PkceAuthorizeRequest.md), `"redirectUri"` \| `"state"`\>

## Returns

`string`

The authorization code
