Skip to content

[Feature] ApiService.ets needs Authorization header support for JWT #24

Description

@lechan775

Problem

Current ApiService.ets has no mechanism to attach an Authorization header:

request.request(BASE_URL + path, {
  method: http.RequestMethod.GET,
  connectTimeout: 15000,
  readTimeout: 15000
}, ...);

This blocks JWT authentication (Issue #4) — once the backend requires tokens, the frontend cannot send them.

Proposed Solution

Add an optional token parameter to all HTTP methods:

static get(path: string, token?: string): Promise<string> {
  const headers: Record<string, string> = { 'Content-Type': 'application/json' };
  if (token) headers['Authorization'] = `Bearer ${token}`;
  // ...
}

The token should be read from CurrentUser preferences (same storage pattern as existing user state).

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions