DEV Community

Jeffrey.Feillp
Jeffrey.Feillp

Posted on

Why I Chose Form-Based Auth Over Dev.to's REST API

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:

  1. Generating an API key from settings
  2. Managing a separate credential
  3. Knowing the API key is valid and not expired

The Form-Based Approach

The form-based approach:

  1. Uses your existing email/password login
  2. Works with session cookies that last weeks
  3. Requires no additional configuration
  4. 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
Enter fullscreen mode Exit fullscreen mode

Product page: https://telegra.ph/Devto-Batch-Publisher--15-USDT-One-Time-Purchase-04-29

Top comments (0)