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.
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.
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) |
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 }'
{ "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" }
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 }'
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 }'