Skip to content

Cloud Components: support authenticated requests (bearer token) in the TES and WES clients #442

Closed

Description

@uniqueg

Why?

The dashboard will use ELIXIR Cloud Components to talk to TES and WES (elixir-cloud-aai/tes-dashboard#31, elixir-cloud-aai/tes-dashboard#32). Those calls must carry the user's LS Login access token (elixir-cloud-aai/tes-dashboard#34). Currently no package in packages/ can send an Authorization header:

  • @elixir-cloud/wes (packages/ecc-client-ga4gh-wes, 2.0.0-alpha): RestWesProvider calls fetch() with no auth headers. The components accept a custom provider (WesProvider interface), so a consumer could subclass, but there is no built-in way to inject a token.
  • @elixir-cloud/tes (packages/ecc-client-ga4gh-tes, 1.0.1, still on the older architecture): src/API/Task/tesGet.ts and the postTask path call the API directly with only a baseURL property.

Without this, the components cannot be used against any authenticated deployment. That includes proTES once elixir-cloud-aai/protes#201 enables bearer validation, as well as WESkit and Conquest.

How?

  1. Agree on the API surface in this issue before coding. Suggested options:

    • (a) an optional headers / getAuthHeaders: () => Promise<Record<string,string>> constructor option on the REST providers, so tokens can be refreshed per request;
    • (b) an optional fetch override.

    Recommendation: (a), with a callback so expiring tokens are handled by the host app.

  2. WES: add it to RestWesProvider and thread it through ecc-client-ga4gh-wes-runs, -run, and -run-create. Add a matching property, e.g. authToken / headers (attribute: false), for consumers that don't construct providers themselves.

  3. TES: add the equivalent to the functions in src/API/Task/*.ts and the runs / create-run components. If this turns out to be cleaner after migrating TES to the provider pattern, do Cloud Components: migrate @elixir-cloud/tes to the v2 provider architecture #443 first.

  4. Apply the same pattern to the other v2 packages (service-registry, trs, drs) if cheap. It is not required for this issue.

  5. Tests: unit tests asserting the header is sent. Update the docs app (apps/documentation) with an example.

  6. Release new versions so that the dashboard can consume them.

Acceptance criteria

  • A consumer can supply a bearer token (static or via callback) to the TES and WES components, and it is sent on every request.
  • Without a token, behaviour is unchanged (backwards compatible).
  • Tests and docs are updated, and a release is published to npm.

Dependencies: none. #443 is optional and may be done first.


Part of the ELIXIR Compute Platform WP4 sprint (M&Ds due end of December 2026).
If you want to work on this issue:

  • Assign yourself (if someone is already assigned, ask them first or pick another one)
  • Move the issue to "In progress" on the project board
  • Start working 🚀

Activity

  1. added
    priority: high
    type: auth
    type: feature
    workload: days
    ecp-wp4: D4.2
    ecp-wp4: M4.4
    on Oct 14, 2026
  2. moved this from Backlog to Ready in ELIXIR On-Cloudon Oct 14, 2026
  3. salihudickson commented on Oct 21, 2026

    @salihudickson
    Contributor

    Hey @uniqueg, I'd like to work on this and the TES migration. I also agree that option A makes more sense for the API.

    Also are there any public GA4GH compliant APIs we can use to test the component functionality? That was a bit of an issue for me while I was trying to reorient myself with the project, had to build a local REST API.

  4. uniqueg commented on Oct 21, 2026

    @uniqueg
    MemberAuthor

    That would be lovely, @salihudickson. Please join the #elixir-on-cloud channel on our Slack and coordinate with Chitransh (@AnonymousXC), who is working on integrating the components into a new version of the Krini portal. He also knows about public TES instances. For WES, we still need to deploy.

  5. moved this from Ready to In progress in ELIXIR On-Cloudon Oct 21, 2026
  6. anuragxxd commented on Oct 22, 2026

    @anuragxxd
    Member

    Quick context before we build anything new: the v2 packages (WES, TRS, TRS-Filer, DRS, DRS-Filer, Service Registry, Cloud Registry) were designed so that the component doesn't own the auth flow; the app using it does. Every component accepts a provider property. You build the provider in your app with whatever auth you need (LS Login, Keycloak, an API key, a proxy that adds headers, or no auth) and pass it in. The component never needs to know which one.

    That was deliberate: different deployments will use different auth flows, and the components shouldn't lock anyone into one.

    Docs and example: https://elixir-cloud-components.vercel.app/docs/wes/providers (see "Custom Providers")

    It is already there for WES (and tested too), #443 will make this available for TES.

  7. removed their assignment
    on Oct 24, 2026
  8. salihudickson commented on Oct 27, 2026

    @salihudickson
    Contributor

    @anuragxxd, the RestWesProvider does not have a fetch method, and it uses the browser's generic fetch for request so the component does not send any headers and cannot send an auth token.

    Please let me know if I'm missing something?

  9. anuragxxd commented on Oct 27, 2026

    @anuragxxd
    Member

    You're right, thanks for catching it! The REST providers called the global fetch directly, so overriding it did nothing. That's fixed in #485, now merged to dev. Every REST provider now sends its requests through an overridable protected fetch(input, init):

    class TokenWesProvider extends RestWesProvider {
      async fetch(input, init = {}) {
        const headers = new Headers(init.headers);
        headers.set("Authorization", `Bearer ${await getToken()}`);
        return super.fetch(input, { ...init, headers });
      }
    }

    Pass it to the components via provider; no per-component token property is needed. The fix will be in the next alpha release.

  10. uniqueg commented on Oct 28, 2026

    @uniqueg
    MemberAuthor

    Closing this one: Anurag's provider design already covers it. Apps add their own login (e.g. the access token) through a custom provider, and since #485 that works for every request. For TES, the same will come with #443. If I've misjudged this and something is still missing, please reopen. I will update the issues in the portal to make sure that providers are used when integrating the cloud components.

  11. moved this from In progress to Done in ELIXIR On-Cloudon Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ecp-wp4: D4.2ecp-wp4: M4.4priority: hightype: authtype: featureworkload: days

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions