# "Magic Link" Signer

## Magic Link Signer

To successfully test and utilize the Magic Link functionality, you need to clone and run a local signer app that processes the signature requests. The **magic link** will redirect to this app, allowing you to sign transactions or token swaps.

**Steps to Set Up the Magic Link Signer App**

1. **Clone the Signer App Repository**: Clone the repository that contains the signer app:

   ```javascript
   git clone https://github.com/crypto-com/cdc-ai-agent-signer-app
   ```
2. **Install Dependencies**: Navigate into the cloned directory and install the required dependencies:

   ```javascript
   cd cdc-ai-agent-signer-app
   npm install
   ```
3. **Run the Signer App**: Start the app using the following command:

   ```javascript
   npm run dev
   ```

   This will start the signer app locally on `http://localhost:5173`.
4. **Pass the Provider in the Client Library**: In the client library configuration, you need to pass this local signer app as the provider in the options:

   ```javascript
   "custom": {
     "provider": "http://localhost:5173"
   }
   ```
5. **Magic Link Redirection**: When you generate a magic link for actions such as sending transactions or swapping tokens, it will redirect the user to this signer app (`http://localhost:5173`). The developer can customize this app to handle various signing operations or UI changes as per their project requirements.

### **Example Magic Link Response**

Here’s how the response looks with a magic link:

```javascript
{
  "status": "Success",
  "action": "SendTransaction",
  "message": "Signature URL created successfully. Please sign the transaction on this link.",
  "data": {
    "magicLink": "http://localhost:5173/sign-transaction/{transactionId}?token={token}"
  }
}
```

In this case, the magic link will redirect to `http://localhost:5173`, where the signer app will display the details of the transaction for the user to approve or reject.

#### **Customizing the Signer App**

The developer can further customize the signer app by modifying the cloned repository to:

* Add custom branding
* Implement additional validation
* Modify the signing flow according to specific use cases

By running the app locally, the developer can see the magic link redirect in action and tweak the behavior to suit their project.
