OpenAPI

GUIDES

Cloudflare Worker profile access

Call the bearer-authenticated profile API from a server-side Worker or backend.

Worker example
export default {
  async fetch(request, env) {
    const response = await fetch("https://identity.lucionglobal.com/api/v1/me", {
      headers: { Authorization: `Bearer ${env.LUCION_TOKEN}` }
    });
    return new Response(await response.text(), {
      status: response.status,
      headers: { "content-type": "application/json" }
    });
  }
};

Deployment checklist

  • Store the token as a server secret, never in client JavaScript.
  • Forward only safe response data to the browser.
  • Preserve X-Request-ID for support correlation without logging the bearer value.
  • Handle 401/403/429/5xx according to the error and retry guidance.