Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Add Authorization Bearer Token Support; Breakout & Update API #3068

Merged
merged 2 commits into from
Feb 12, 2025

Conversation

pglombardo
Copy link
Owner

@pglombardo pglombardo commented Feb 11, 2025

Description

This PR improves & cleans up the API:

  • The Authorization: Bearer <token> header is the preferred method for all requests.
  • Deprecated the X-User-Email and X-User-Token headers.
    • These auth headers will probably still be supported indefinitely for v1 of the API and not carried into v2.
  • Broken out API routes into their own controller and namespace.
  • Updated API documentation.

Some clients may need minor updates if they were relying on non-standard behavior.

If something breaks, it's likely due to one of the following:

  • All API requests must be made to .json endpoints. (e.g. /p.json and NOT /p)
  • Unauthorized requests will now return a 401 Unauthorized status code without a response body.
  • Bad credentials will now return a 401 Unauthorized. Previously, the API would act anonymously and end up confusing countless victims.
  • The API now enforces JSON format for all requests and request body.

See Also

Related Issue

Type of Change

  • 📚 Examples / docs / tutorials / dependencies update
  • 🔧 Bug fix (non-breaking change which fixes an issue)
  • 🥂 Improvement (non-breaking change which improves an existing feature)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🔐 Security fix

Checklist

  • I've written tests (if applicable) for all new methods and classes that I created. (rake test)
  • I've added documentation as necessary so users can easily use and understand this feature/fix.

app/controllers/urls_controller.rb Dismissed Show dismissed Hide dismissed
@pglombardo pglombardo force-pushed the api-breakout-and-update branch from 1924683 to 6735735 Compare February 12, 2025 15:13
@pglombardo pglombardo merged commit db4fe4c into master Feb 12, 2025
6 checks passed
@pglombardo pglombardo deleted the api-breakout-and-update branch February 12, 2025 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant