Repository navigation
Windows failure when adding OAuth alias: keychain “password encoded as UTF-16” exceeds 2560 chars #132
Unanswered
sonisoft-cnanda
asked this question in
Help and Questions with SDK or Fluent
Replies: 1 comment 1 reply
|
Hi @sonisoft-cnanda, thanks for reporting this. We are aware of this limitation in windows and we do store as a single JSON Blob to avoid some issues in mac. workaround for windows is to remove the existing credential before adding a new one |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Title: Windows failure when adding OAuth alias: keychain “password encoded as UTF-16” exceeds 2560 chars
Summary
When running
now-sdk auth --add <instance> --type oauthon Windows, adding an additional ServiceNow SDK OAuth credential alias fails with:ERROR: Attribute 'password encoded as UTF-16' is longer than platform limit of 2560 charsAfter failure,
now-sdk auth --listdoes not show the newly-added alias. I can confirm this is reproducible based on the number of existing stored aliases/tokens: removing one existing alias and then adding the previously failing alias works correctly.Environment
node_modules/@servicenow/sdk-cli/package.json:@servicenow/sdk-cli:4.11.2@napi-rs/keyring:1.2.0Observed behavior
Adding OAuth credentials via interactive flow fails during credential persistence to OS keychain:
ERROR: Attribute 'password encoded as UTF-16' is longer than platform limit of 2560 charsnow-sdk auth --list.Expected behavior
now-sdk auth --add ... --type oauthshould successfully store the OAuth alias on Windows regardless of the existing number of aliases (or at least fail with a clear actionable message and a supported workaround).Reproduction steps
now-sdk auth --add <instance> --type oauthnow-sdk auth --list.Confirmation
I removed one previous alias (so I had fewer stored aliases) and then added the one that was failing; it worked fine.
Investigation / likely root cause
@servicenow/sdk-cliappears to store all credential aliases inside one keychain “password” value by writing a single JSON blob.Evidence from code
In
@servicenow/sdk-cli, the keychain wrapper is initialized with a single service/account pair:node_modules/@servicenow/sdk-cli/src/auth/keychain/index.tsprivate readonly account = 'now-sdk'new Entry(this.service, this.account)And credential persistence stores the entire alias map as one JSON string:
node_modules/@servicenow/sdk-cli/src/auth/index.tsAll reactions