Skip to content

REST auth.clientId not derived from token details (RSA7b, RSA12) #2192

@paddybyers

Description

@paddybyers

Spec points

  • RSA7b: "The clientId attribute of the Auth object is derived from the tokenDetails that are returned from an explicit auth request, or from the authCallback."
  • RSA12: Wildcard clientId (*) should be accessible via auth.clientId.

Observed behaviour

For REST clients, auth.clientId is only set from ClientOptions.clientId (via _userSetClientId during construction). It is not extracted from:

  • tokenDetails.clientId passed in the constructor
  • TokenDetails.clientId returned by authCallback
  • TokenDetails.clientId returned by authorize()

The _uncheckedSetClientId method exists but is only called from the Realtime ConnectionManager (on CONNECTED), never from REST token acquisition paths (_saveTokenOptions, _ensureValidAuthCredentials).

Failing tests (5)

Test Expected Actual
RSA7b - clientId from TokenDetails auth.clientId === 'token-client-id' undefined
RSA7b - clientId from authCallback TokenDetails auth.clientId === 'callback-client-id' undefined
RSA7 - clientId updated after authorize() auth.clientId updates after authorize() undefined
RSA12 - Wildcard clientId auth.clientId === '*' undefined
RSA7 - case 5: clientId inherited from token auth.clientId === 'token-client' undefined

Reproduction

RUN_DEVIATIONS=1 npx mocha --grep "RSA7b|RSA12|RSA7 - case 5|RSA7 - clientId updated" test/uts/rest/auth/client_id.test.ts

From PR #2191, branch uts-rest.

┆Issue is synchronized with this Jira Task by Unito

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. It's clear that this does need to be fixed.uts-issueIssues raised there there is an apparent discrepancy between this library and the UTS tests

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions