fix(translate): move Smartling auth to da-etc and auto-connect, matching Trados/Lionbridge - #719
Draft
markdaugherty wants to merge 4 commits into
Draft
fix(translate): move Smartling auth to da-etc and auto-connect, matching Trados/Lionbridge#719markdaugherty wants to merge 4 commits into
markdaugherty wants to merge 4 commits into
Conversation
- Add smartling/auth.js: gets short-lived tokens from da-etc instead of sending raw userIdentifier/userSecret from the browser to Smartling - smartling/index.js keeps only Smartling API business logic; connect()/ isConnected() delegate to auth.js - Extract shared da-etc login + token-cache helpers into loc/utils/auth.js, used by both trados/auth.js and smartling/auth.js - Scope cached tokens by org/site/env (loc/utils/auth.js tokenKey) so different sites no longer collide on the same cache entry - Update smartling connector tests for the new auth flow Co-Authored-By: Claude <noreply@anthropic.com>
# Conflicts: # nx/blocks/loc/connectors/smartling/index.js # nx/blocks/loc/connectors/trados/auth.js # nx/blocks/loc/utils/auth.js # test/loc/connectors/smartling/index.test.js
- smartling/index.js delegates isConnected/connect and per-request auth to auth.js instead of its own duplicated raw-credential flow (reintroduced by a merge) - auth.js now reads the current token from the shared cache (getToken) instead of a module-level variable - utils/auth.js: rename loginViaDaEtc -> login Co-Authored-By: Claude <noreply@anthropic.com>
…click - isConnected/connect now share one ensureConnected() implementation that authenticates via da-etc on a cache miss, matching Trados/Lionbridge's authReady - no more separate manual "Connect" step to start a project - Fixes a latent bug where a valid cached token was reported as disconnected if the refresh schedule was already armed - Add test coverage for the auto-connect path Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
smartling/auth.js: gets short-lived tokens from da-etc instead of sending rawuserIdentifier/userSecretfrom the browser to Smartlingsmartling/index.jskeeps only Smartling API business logic;connect()/isConnected()and per-request auth delegate toauth.jsloc/utils/auth.js(already shared by Trados/Lionbridge) with connector-agnosticlogin/getCachedToken/setCachedTokenhelpers, reused by Smartling's auth flowisConnected/connectnow share one implementation that authenticates via da-etc on a cache miss, so Smartling connects automatically like Trados/Lionbridge instead of requiring a manual "Connect" click before starting a projectFull test suite (105 files) passes locally.