Why I Chose Form-Based Auth Over Dev.to's REST API
When I set out to automate Dev.to publishing, I had two options: use the official REST API with an API key, or use Dev.to's form-based submission system. Here's why I chose the latter.
The Official API
Dev.to's REST API at /api/articles works well, but requires:
- Generating an API key from settings
- Managing a separate credential
- Knowing the API key is valid and not expired
The Form-Based Approach
The form-based approach:
- Uses your existing email/password login
- Works with session cookies that last weeks
- Requires no additional configuration
- Is actually simpler to implement
The Trade-off
The form-based approach is more fragile β if Dev.to changes their HTML structure, the CSRF token extraction might break. But for a CLI tool that you run occasionally, this trade-off is worth it for the simplicity.
Get the Tool
I packaged the complete solution. It includes both the form-based approach and session management.
$15 USDT (TRC-20)
TNeUMpbwWFcv6v7tYHmkFkE7gC5eWzqbrs
Product page: https://telegra.ph/Devto-Batch-Publisher--15-USDT-One-Time-Purchase-04-29
Top comments (0)