What Changed?

Previously, API requests required the Authorization: Token YOUR_API_KEY header format. Now, you can also use the standard OAuth2-style Authorization: Bearer YOUR_API_KEY format. Both methods are fully equivalent and use the same API key.

Authentication Methods

MobileAPI.dev supports three authentication methods, listed in order of recommendation:

1. Authorization Header with Token (Recommended)

GET /devices/search/?name=iPhone+17
Authorization: Token YOUR_API_KEY

2. Authorization Header with Bearer (New)

GET /devices/search/?name=iPhone+17
Authorization: Bearer YOUR_API_KEY

3. Query Parameter (Fallback)

GET /devices/search/?name=iPhone+17&key=YOUR_API_KEY

Code Examples

Python with requests

import requests

# Using Token (traditional)
headers = {"Authorization": "Token YOUR_API_KEY"}
response = requests.get("https://api.mobileapi.dev/devices/search/", 
                        headers=headers, 
                        params={"name": "iPhone 17 Pro"})

# Using Bearer (new)
headers = {"Authorization": "Bearer YOUR_API_KEY"}
response = requests.get("https://api.mobileapi.dev/devices/search/", 
                        headers=headers, 
                        params={"name": "iPhone 17 Pro"})

JavaScript with fetch

// Using Bearer token
const response = await fetch(
  "https://api.mobileapi.dev/devices/search/?name=iPhone%2017%20Pro",
  {
    headers: {
      "Authorization": "Bearer YOUR_API_KEY"
    }
  }
);
const data = await response.json();

cURL

# Token format
curl -H "Authorization: Token YOUR_API_KEY" \
  "https://api.mobileapi.dev/devices/search/?name=iPhone%2017%20Pro"

# Bearer format
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.mobileapi.dev/devices/search/?name=iPhone%2017%20Pro"

Security Best Practices

We recommend using the Authorization header (either Token or Bearer) over query parameters for these reasons:

  • URL Security: Query parameters may be logged in server access logs, browser history, and proxy logs
  • HTTPS Protection: Headers are encrypted along with the request body, while URLs may be visible before encryption
  • Standard Compliance: Using Authorization headers follows REST API security best practices

Migration Guide

No migration is required! If you are currently using Token authentication, your existing code will continue to work without any changes. The Bearer format is simply an additional option for developers who prefer it or whose tools default to Bearer authorization.

Why Both Formats?

We added Bearer token support because:

  • OAuth2 Compatibility: Many modern frameworks and libraries default to Bearer token format
  • Developer Experience: Popular tools like Postman, Insomnia, and HTTPie often default to Bearer format
  • Industry Standards: Bearer tokens are the standard in RFC 6750 for OAuth 2.0 authorization

Questions?

If you have any questions about authentication or need help with your integration, please reach out through our support channels or check our API documentation for more details.