---
eip: 1207
label: ERC-1207
title: DAuth Access Delegation Standard
status: Stagnant
type: Standards Track
category: ERC
created: 2018-07-10
official: https://eips.ethereum.org/EIPS/eip-1207
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1207.md
canonical: https://eips.huatuo.xyz/eip-1207/
lang: en
tldr: "An OAuth-style pattern for contracts: a user grants another contract time-limited permission to call named functions on their behalf, without sharing a private key."
tags: [authorization, delegation, access-control, interface]
---

# ERC-1207: DAuth Access Delegation Standard

> DAuth is a standard interface for accessing authorization delegation between smart contracts and users.

**TL;DR:** An OAuth-style pattern for contracts: a user grants another contract time-limited permission to call named functions on their behalf, without sharing a private key.

## What problem does it solve?

Most contracts assume the user calls every function themselves with their own key, so `msg.sender` is always the owner. Sometimes a user wants another contract (a "client" app) to act on their data or assets in a "resource" contract, for example to approve tokens on their behalf. There was no common way to express that delegation.

DAuth borrows the idea of OAuth from the web: the user grants a specific contract access to a specific set of functions until an expiry time. Because Ethereum storage is public and `msg.sender` is reliable, no access token is needed; the resource contract just records who granted what to whom.

## How it works

The resource contract stores, per (user, client contract) pair, an `AuthInfo`:

```solidity
struct AuthInfo {
    string[] funcNames; // functions the client may call
    uint expireAt;      // unix timestamp
}
mapping(address => mapping(address => AuthInfo)) userAuth;
```

Interface:

| Function / event | Purpose |
| --- | --- |
| `grant(grantee, invokes, expireAt)` | User authorises a client; `invokes` is a space-separated list of function names. Emits `Grant` |
| `regrant(...)` | Optional: change an existing grant |
| `revoke(grantee)` | Remove a grant. Emits `Revoke` |
| `verify(authorizer, invoke)` | Internal check that the caller is allowed to call `invoke` for `authorizer` |
| `callableFuncNames` / `updateCallableFuncNames` | Which functions the resource contract exposes to delegates at all |

Every delegatable function is **overloaded**: the normal version acts for `msg.sender`, and a second version takes an extra `authorizer` address, calls `verify`, and acts for that user.

## Sample code

The pattern from the spec, applied to an ERC-20 style `approve`:

```solidity
function approve(address spender, uint256 value) public returns (bool) {
    return _approve(msg.sender, spender, value);
}

// Called by a client contract that the user has granted "approve" to
function approve(address spender, uint256 value, address authorizer) public returns (bool) {
    verify(authorizer, "approve");
    return _approve(authorizer, spender, value);
}

function _approve(address owner, address spender, uint256 value) internal returns (bool) {
    allowed[owner][spender] = value;
    emit Approval(owner, spender, value);
    return true;
}
```

The user grants access once:

```solidity
resource.grant(clientContract, "approve transfer", block.timestamp + 7 days);
```

## Things to know

- Status is **Stagnant**. It did not become a widely used standard.
- Permissions are stored and compared as strings, which is gas-heavy; a modern design would more likely use function selectors (`bytes4`).
- A grant is broad: the client can call the named function with any arguments until expiry or revocation. Keep expiries short and grant only what is needed.
- Today the common approaches to "someone else acts for me" are signed approvals such as [ERC-2612](/eip-2612/) `permit` and meta-transactions such as [ERC-2771](/eip-2771/), rather than per-contract grant tables.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-1207
