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

# Triggering Delegation

> How to trigger delegation for a user in React Native.

In your application, when a user is logged in, you'll want to request delegation for your application so your server can act on their behalf (for example, to sign transactions or run automated flows). You can do this in React Native in the following ways.

## Dynamic's UI

### Auto-prompt user on sign in

If you chose to **prompt users on sign in** in the [Delegated Access Setup](/overview/wallets/embedded-wallets/mpc/delegated-access/configuration), the user is prompted to approve delegation for your application when they next sign in. No extra code is required in your app.

### User-triggered delegation

The user can manually trigger delegation at any time from the Dynamic Widget: **Settings → Security → Connected Apps → Wallets Delegated**. Open the user profile (e.g. via your menu or a "Manage account" button that calls Dynamic's user profile UI), then the user can navigate to that section and approve or manage delegation.

## Using the Client API

You can use the Dynamic client's delegation module to trigger delegation programmatically:

```typescript theme={"system"}
import { createClient } from '@dynamic-labs/client';
import { ChainEnum } from '@dynamic-labs/sdk-api-core';

const client = createClient({
  environmentId: 'your-environment-id',
  // ... other config
});

// Trigger delegation for all user wallets
await client.wallets.waas.delegation.initDelegationProcess({});

// Or trigger delegation for specific wallets
await client.wallets.waas.delegation.initDelegationProcess({
  walletIds: ['wallet-id-1', 'wallet-id-2'],
});

// Check if delegation prompt should be shown
const shouldPrompt = await client.wallets.waas.delegation.shouldPromptWalletDelegation();

// Get delegation status for all wallets
const walletsStatus = await client.wallets.waas.delegation.getWalletsDelegatedStatus();
```

### Delegate Key Shares

You can delegate key shares for specific wallets with optional password encryption:

```typescript theme={"system"}
// Delegate without password
await client.wallets.waas.delegation.delegateKeyShares({
  wallets: [
    { chainName: ChainEnum.Evm, accountAddress: '0x123...' },
    { chainName: ChainEnum.Sol, accountAddress: 'abc...' },
  ],
});

// Delegate with password encryption
await client.wallets.waas.delegation.delegateKeyShares({
  wallets: [
    { chainName: ChainEnum.Evm, accountAddress: '0x123...' },
  ],
  password: 'secure-password',
});
```

<Note>
  When a password is provided, the delegated share will be encrypted with the password, providing an additional layer of security. Learn more about [password encryption](/react-native/wallets/embedded-wallets/mpc/password-encryption).
</Note>

### Available Delegation Methods

| Method                         | Description                                                                |
| ------------------------------ | -------------------------------------------------------------------------- |
| `initDelegationProcess`        | Initiates the delegation process for specified wallets or all user wallets |
| `shouldPromptWalletDelegation` | Checks if the user should be prompted for delegation                       |
| `getWalletsDelegatedStatus`    | Returns delegation status for all user wallets                             |
| `delegateKeyShares`            | Delegates key shares for specific wallets (with optional password)         |
| `revokeDelegation`             | Revokes delegation for specific wallets (with optional password)           |
| `denyWalletDelegation`         | Denies delegation for a specific wallet                                    |
| `dismissDelegationPrompt`      | Dismisses the delegation prompt for a wallet                               |
| `clearDelegationSessionState`  | Clears delegation session state                                            |

<Card title="What's next?" icon="link" color="#4779FE" href="/react-native/wallets/embedded-wallets/mpc/delegated-access/receiving-delegation">
  Learn how to properly receive the delegation materials on your server
</Card>
