> For the complete documentation index, see [llms.txt](https://api.senderwiz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.senderwiz.com/admin/customer-login-via-token.md).

# Customer Login via Token

### 🔐 Customer Login via Token (Admin Key)

Allow your own application to securely log in customers to SenderWiz without requiring manual entry of email and password on the SenderWiz login screen. This acts as a single sign-on (SSO)-like experience using admin-level API authentication.

With this endpoint, admins can generate a login token for any of their customers and redirect them directly to SenderWiz, bypassing the login form.

***

#### 🔹 HTTP Request

```http
POST ADMIN-API-URL/admin-generate-token
```

***

#### 🔸 Authorization Header

Include your customer API key:

```
X-ADMIN-API-KEY: your-admin-api-key-here
```

***

🔸 Query Parameters

| Parameter | Required | Description                   |
| --------- | -------- | ----------------------------- |
| `email`   | Yes      | Email address of the customer |

#### 🔐 Authorization Header

Include your customer API key:

```
X-ADMIN-API-KEY: your-admin-api-key-here
```

***

**💻 PHP Example**

```php
// GENERATE LOGIN TOKEN FOR CUSTOMER
$response = $endpoint->generateToken([
    'email' => 'emma.waters@demo.com',
]);

// DISPLAY RESPONSE
echo '<hr /><pre>';
print_r($response->body);
echo '</pre>';

```

***

#### 📦 Sample JSON Response

```json
{
  "status": "success",
  "login_url": "https://demo.com/customer/guest/api-login/05530c1914f50d2e07f6318f61c636d7"
}
```

***

#### 🔁 Redirection

Once the login URL is generated, you can automatically redirect your customer to that URL. The token is valid for 10 minutes. After expiration, the customer will be redirected back to your own login system.

***

#### ✅ Benefits

* Seamless login experience for your customers
* Works like Single Sign-On (SSO)
* Secure and time-bound access (10-minute token validity)
* No password entry required

***

#### ⚠️ Note

* Ensure token-based login URLs are used immediately.
* Do not share login URLs externally. Use them only within secure application redirections.
