## MedplumClient.exchangeExternalAccessToken() method

Exchange an external access token for a Medplum access token.

**Signature:**

```typescript
exchangeExternalAccessToken(token: string, clientId?: string, membershipId?: string): Promise<ProfileResource>;
```

## Parameters

| Parameter     | Type    | Description                                                                                       |
|---------------|---------|---------------------------------------------------------------------------------------------------|
| token         | string  | The access token that was generated by the external identity provider.                            |
| clientId      | string  | _(Optional)_ The ID of the `ClientApplication` in your Medplum project that will be making the exchange request. |
| membershipId  | string  | _(Optional)_ Optional membership ID to restrict the exchange to a specific ProjectMembership.     |

**Returns:**

Promise< [ProfileResource](/content/docs/sdk/core.profileresource) >

- [MedplumClient.exchangeExternalAccessToken() method](/content/docs/sdk/core.medplumclient.exchangeexternalaccesstoken#medplumclientexchangeexternalaccesstoken-method/index.html)  
- [Parameters](/content/docs/sdk/core.medplumclient.exchangeexternalaccesstoken#parameters/index.html)
