Skip to content

LOGIN_TOKEN: sign a JWT for the login request (noon Partner API) #1235

Closed

Description

@helpcodeai

Problem

Some APIs log in with a JWT the client signs itself, instead of a password. noon's Partner API (the marketplace seller API of noon.com, UAE/KSA/Egypt) works this way (Authenticating requests, APILogin):

  1. The seller downloads a service account key (key_id, private_key, project_code).
  2. The client signs an RS256 JWT with sub = key_id, iat = now in whole seconds and a fresh jti, one per login.
  3. POST https://noon-api-gateway.noon.partners/identity/public/v1/api/login with {"token": "<jwt>", "default_project_code": "..."}.
  4. The session comes back as cookies; every later call sends them, plus a User-Agent.

LOGIN_TOKEN already covers steps 3 and 4 (tokenSource: "cookie", cookieMode: "all", re-login on 401). The engine can already sign JWTs (client-assertion.util.ts, RS256/RS384/RS512/PS256/ES256/ES384), but only as an OAuth2 private_key_jwt client assertion. So a noon adapter is not possible today without an external proxy that signs for us.

Proposal

An optional signedJwt block in a LOGIN_TOKEN authConfig:

"signedJwt": {
  "privateKey": "{{NOON_PRIVATE_KEY}}",
  "algorithm": "RS256",
  "claims": { "sub": "{{NOON_KEY_ID}}" }
}
  • A fresh JWT is signed for every login (iat = now in seconds, random jti, the configured claims; exp only when ttlSeconds is set) and is available to loginBody as ${signedJwt}.
  • The key is parsed like the client assertion key (PEM PKCS#1/PKCS#8/SEC1, single-line pastes, clear errors that never contain key material); the signer is shared with client-assertion.util.ts.
  • username / password are not required when signedJwt is set.
  • Nothing changes for existing LOGIN_TOKEN connectors.

Cloud and self-hosted behave the same: the signing happens in the backend that runs the connector; the key is stored encrypted like any other credential.

First user

A noon-marketplace catalog adapter (catalog, content, offers, pricing, stock, warehouses, FBPI orders and shipments, exports), writes installed switched off where they change prices, stock or orders.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions