Auth API Entity

Overview

The Auth entity provides a secure way to grant authenticated access to store areas without requiring users to manually enter their credentials in a login form. This is particularly useful for creating authenticated links that can be sent to users via email or other channels.

Supported Methods: The Auth entity only supports POST requests.

Response

When you make a POST request to the Auth endpoint, it returns a generated session key and a ready-to-use link that users can follow to gain authenticated access to the specified area of the store.

POST /api/auth

Request Parameters

Parameter Type Required Description
user_id* integer Yes ID of the user to authenticate
redirect_url string No URL where the user will be redirected after authentication
expiry_time integer No Time in seconds until the link expires (default: 3600)

Example Request

curl -X POST \
  https://www.venddor.com.br/api/auth \
  --user admin@example.com:APIkey \
  -H 'Content-Type: application/json' \
  -d '{
    "user_id": 42,
    "redirect_url": "https://www.venddor.com.br/admin/dashboard",
    "expiry_time": 7200
  }'

Example Response

{
  "session_key": "AbCdEf123456",
  "auth_url": "https://www.venddor.com.br/auth/login?key=AbCdEf123456&redirect_url=https%3A%2F%2Fwww.venddor.com.br%2Fadmin%2Fdashboard",
  "expiry": "2025-04-15T14:34:56Z"
}
Tip: When sending Auth links to users via email, consider using descriptive link text that clearly explains where the link will take them.

Usage Examples

Generating a One-Click Login Link

This example shows how to generate a direct login link for a specific user:

curl -X POST \
  https://www.venddor.com.br/api/auth \
  --user admin@example.com:APIkey \
  -H 'Content-Type: application/json' \
  -d '{
    "user_id": 42
  }'

Creating a Password Reset Link

This example demonstrates how to create a password reset link with a shorter expiration time:

curl -X POST \
  https://www.venddor.com.br/api/auth \
  --user admin@example.com:APIkey \
  -H 'Content-Type: application/json' \
  -d '{
    "user_id": 42,
    "redirect_url": "https://www.venddor.com.br/account/reset_password",
    "expiry_time": 1800
  }'
Security Notice: Authentication links provide full access to user accounts. Always use HTTPS for these requests and ensure links are sent securely to the intended recipients.