> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://www.openfort.io/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

# wallet\_revokePermissions

Revokes a permission. Based on [ERC-7715](https://github.com/ethereum/ERCs/blob/23fa3603c6181849f61d219f75e8a16d6624ac60/ERCS/erc-7715.md), the same standard as [`wallet_grantPermissions`](https://www.openfort.io/docs/products/cross-app-wallet/rpc/wallet_grantPermissions).

A permission granted to an Application stays usable until it expires or until it is revoked. Call this method when the session should end earlier than `expiry`: the user signs out, the user turns off a "keep me signed in" style setting, or the Application rotates the key it signs with. Without a revocation the Application keeps the ability to send the calls the grant covers, for the whole lifetime of the grant.

Identify the permission with the `permissionsContext` value that [`wallet_grantPermissions`](https://www.openfort.io/docs/products/cross-app-wallet/rpc/wallet_grantPermissions) returned, so store that value alongside the session it belongs to. Once a permission is revoked its context cannot be reused; request a new grant to start another session.

## Request

```ts
type Request = {
  method: 'wallet_revokePermissions',
  params: [{
    /** Permission context returned by wallet_grantPermissions. */
    permissionContext: `0x${string}`
  }]
}
```

### Parameters

| Parameter           | Type            | Required | Description                                                                                                                           |
| ------------------- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `permissionContext` | `0x${string}`   | Yes      | Identifies the permission to revoke. It is the `permissionsContext` returned by [`wallet_grantPermissions`](https://www.openfort.io/docs/products/cross-app-wallet/rpc/wallet_grantPermissions). |

## Example

:::warning
To make these instructions concrete, we have created a sample cross-app wallet called **Rapidfire ID**. To interact with it, you can find its SDK in the NPM package directory: [@rapidfire/id](https://www.npmjs.com/package/@rapidfire/id).

You can check out the GitHub [repository for Rapidfire Wallet](https://github.com/openfort-xyz/ecosystem-sample) to learn how to create your own wallet.
:::

```ts
import RapidfireID from '@rapidfire/id'

const rapidfire = new RapidfireID()
const provider = rapidfire.getEthereumProvider()

const permissions = await provider.request({
  method: 'wallet_grantPermissions',
  params: [{ expiry: 7 * 24 * 60 * 60, permissions: [/* ... */] }],
})

// Later, when the session ends:
await provider.request({// [!code focus]
  method: 'wallet_revokePermissions',// [!code focus]
  params: [{ permissionContext: permissions.permissionsContext }],// [!code focus]
})// [!code focus]
```

## Errors

| Code     | Meaning      | When it happens                                                                  |
| -------- | ------------ | ---------------------------------------------------------------------------------- |
| `4100`   | Unauthorized | The Application calls the method before `eth_requestAccounts` has connected it.     |
| `-32602` | Invalid params | `params` is neither an array nor an object, as required by the provider.          |

## Related

* [`wallet_grantPermissions`](https://www.openfort.io/docs/products/cross-app-wallet/rpc/wallet_grantPermissions) issues the `permissionsContext` this method consumes.
* [`wallet_sendCalls`](https://www.openfort.io/docs/products/cross-app-wallet/rpc/wallet_sendCalls) is the method that spends a live permission.
* [`wallet_getCapabilities`](https://www.openfort.io/docs/products/cross-app-wallet/rpc/wallet_getCapabilities) reports whether the connected chain supports permissions at all.
