Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Secure a hosted query API by treating the React app as public, using only a provider-approved public key in browser code, and enforcing user and object permissions at the API or data layer. Keep elevated credentials and private upstream keys behind a trusted server that authenticates the caller and checks authorization. CORS helps control browser access, but it does not secure an API against scripts or other non-browser clients.

Understand the security boundary

A React application runs on a device controlled by its user. Any key, endpoint, request, or permission check included in its bundle can be inspected or changed. Minifying code, hiding a button, or storing a value in browser storage does not make it secret.

Separate the system into three roles:

  • Browser app: presents the interface and makes requests. Treat all shipped code and credentials as public.
  • Hosted API and data layer: authenticates requests and enforces which users can read, change, or invoke what.
  • Trusted backend, when needed: holds elevated credentials or private third-party keys and performs privileged work only after checking the caller’s identity and permission.

A provider-designated public or publishable project key may be suitable in a browser if the provider intends it for client use and the API’s authorization rules are correctly configured. That key identifies the application or project; it is not proof that a request comes from an authorized user.

Choose direct access or a backend for each operation

Direct browser-to-provider access can be appropriate when users can be authenticated, the provider enforces user- and object-level permissions, and the operation needs no secret credential or custom privileged logic. Add a server or function for the operations that need elevated access, private upstream keys, or authorization rules that the hosted API cannot safely enforce.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Question Direct browser access is more suitable when… Use a trusted backend when…
Can permissions be enforced per user and object? The provider can enforce them at the API or data layer for every relevant operation. They require application-specific checks the provider cannot enforce safely.
Does the request need an elevated or third-party secret? No; it uses only credentials explicitly designated for shipped client code. Yes; the secret stays on the server and is never returned to the browser.
Does the operation have privileged business rules? No; the provider’s user-scoped controls fully express the rules. Yes; the backend authenticates the caller and independently checks those rules.
Can requests and costs be bounded? The provider offers suitable request, rate, and cost controls. A backend is needed to apply additional limits or validate costly actions.

A backend is not automatically safer: a proxy that accepts arbitrary client requests and forwards them with a powerful credential simply relocates the risk. Apply authentication, authorization, input validation, and limits at that boundary too.

Use public application keys and protect user data

Keep elevated keys out of React

Use only a key the provider explicitly designates for browser, mobile, or other shipped code. Keep secret, service, administrative, and private third-party credentials on a controlled backend. A secret accidentally included in a frontend environment variable is still exposed if the build embeds it in the browser bundle.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Supabase is one provider-specific example, not a universal key model. Its guidance says to use a publishable key in shipped code and reserve secret keys for controlled backend components; it warns, “A leaked secret key exposes all of your project’s data.” Supabase says secret keys bypass row-level security. Its documentation also says legacy anon and service_role keys are being deprecated by the end of 2026; consult its current migration guidance rather than assuming another provider uses the same key names or timeline. See Supabase API keys.

Firebase illustrates why provider guidance matters: its client API keys identify the Firebase project or app, while authorization relies on controls such as IAM, Firebase Security Rules, and App Check. A key’s visibility or label alone does not tell you what access it grants. See Google Firebase’s API key guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Authenticate users and authorize every operation

When data is user-specific, sign users in and have the API verify their identity, typically through a validated token or session. Then enforce permission for each operation and each object identifier. Do not assume possession of a public project key means the caller may access the data.

  • Check that a user may access the specific record requested, not merely that the user is signed in.
  • Do not trust client-supplied ownership fields, role names, or account identifiers without validating them against trusted identity and policy data.
  • Do not rely on hidden buttons or frontend-only checks to protect an action.
  • Review read and write access to individual fields as well as access to the object or endpoint.

Supabase’s React quickstart demonstrates its JavaScript client, while its security guidance describes frontend access protected by policies and authenticated JWTs. For its database APIs, review both Postgres grants and row-level security (RLS): grants govern which roles can reach objects, and RLS policies constrain rows available to a caller. Policies need to cover every exposed table and the roles in use. Provider-level grants can block a request before an RLS policy is reached, so check both layers when diagnosing access. See Supabase Auth with React, Securing your data, and Supabase GraphQL.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Put privileged work behind a checked server boundary

Route an operation through a server or function if it needs an elevated provider credential, a private third-party key, or custom authorization that must not be controlled by the browser. The server should validate the caller’s identity, independently decide whether that caller may perform the requested action, validate the input, and use a least-privilege credential for the work.

  1. Authenticate: validate the user’s session or token on the server; do not accept a user ID asserted only in the request body.
  2. Authorize: check the user’s permission for the requested action and target object before using privileged access.
  3. Constrain: allow only the required operation and fields, validate parameters, and cap result counts, payload sizes, batches, and expensive work.
  4. Respond carefully: return only fields the caller may see and avoid exposing internal errors or credentials.

Never make the server a blind pass-through that lets a caller choose arbitrary endpoints, queries, or privileged actions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Apply browser and API protections together

Configure CORS narrowly, but do not mistake it for authorization

Allow only the web origins the application needs, and permit only necessary HTTP methods and headers. CORS is enforced by browsers: it can prevent an unapproved web page from reading a cross-origin response in that browser, but it does not stop requests from command-line tools, scripts, or modified clients. The API must still authenticate and authorize every request. OWASP explains this distinction in its REST Security Cheat Sheet.

Validate and limit requests

Validate query parameters and request bodies on the server, including identifiers, allowed fields, ranges, and formats. Set maximum page sizes and payload sizes; bound batch operations and expensive queries; and rate-limit costly or sensitive actions. Where suitable, use per-user or per-key limits in addition to IP-based limits, and configure provider spending caps or billing alerts when available. These controls reduce both abuse and accidental runaway usage. See OWASP’s API4:2023 Unrestricted Resource Consumption.

Harden transport, errors, and the API surface

  • Use HTTPS/TLS for API traffic.
  • Allow only the HTTP methods and request headers the application needs.
  • Keep passwords, tokens, and API keys out of URL query strings, where URLs may be logged.
  • Return useful client errors without stack traces, secrets, or unnecessary internal detail.
  • Review response fields, writable properties, cache and security headers where relevant, and authorization at object, property, and function levels.
  • Inventory deployed endpoints and API versions; remove or secure unused routes.

These controls address more than key theft. OWASP’s 2023 API risk categories include broken object-, property-, and function-level authorization; broken authentication; unrestricted resource consumption; security misconfiguration; improper inventory management; and unsafe consumption of APIs, among others. See the OWASP API Top 10 and API8:2023 Security Misconfiguration.

Implement the controls in a safe order

  1. Map data and operations: identify sensitive data, the endpoints the React app calls, and which operations users actually need.
  2. Inventory credentials: classify each key by provider purpose and where it runs. Remove elevated credentials from frontend variables, source maps, build artifacts, browser storage, and client requests.
  3. Rotate exposed secrets: if a secret credential reached a client build or other public location, treat it as compromised and rotate it; removing it from the current source alone does not revoke copies already exposed.
  4. Set up identity and permissions: authenticate users where needed and enforce access at every operation and object. For row-policy systems, cover exposed tables and relevant roles.
  5. Move privileged operations: put elevated credentials and private upstream calls behind a server or function that checks identity and permission, then applies least privilege.
  6. Constrain and harden: configure narrow CORS origins, TLS, necessary methods and headers, validation, request limits, cost controls, and safe error responses.
  7. Test authorization cases before release: check expected anonymous and signed-in access, cross-user attempts, and privileged operations. Confirm denied cases fail at the API or data layer rather than only in the interface.
  8. Review continuously: inventory endpoints and versions, inspect logs and exposed fields, and remove unused routes and credentials.

What to test before release

Test with representative identities and objects, not only the happy path. A secure result means the API rejects unauthorized requests even when a caller bypasses the React interface or changes a request manually.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Anonymous callers cannot read or change data that requires sign-in.
  • A signed-in user cannot access another user’s records by changing an object ID.
  • Users cannot modify ownership, role, or other protected fields by submitting them in a payload.
  • Privileged operations reject callers without the required permission.
  • Oversized pages, payloads, batches, or repeated costly calls are rejected or bounded.
  • Responses and errors do not disclose fields, credentials, stack traces, or internal details the caller should not receive.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.