feat: add opt-in @okta/okta-angular/client-js entry point - #189
Open
BenjaminTruong-okta wants to merge 1 commit into
Open
feat: add opt-in @okta/okta-angular/client-js entry point#189BenjaminTruong-okta wants to merge 1 commit into
BenjaminTruong-okta wants to merge 1 commit into
Conversation
Adds Angular-idiomatic support for the beta @okta/okta-client-javascript SDK as an alternative to the existing okta-auth-js-based guards, wired through Angular's dependency injector rather than porting the okta-react client-js factory/closure shape. - New lib/client-js secondary entry point: provideClientJsAuth registers a consumer-constructed orchestrator/fetchClient via CLIENT_JS_ORCHESTRATOR/CLIENT_JS_FETCH_CLIENT injection tokens; tokenGuard, loginCallbackGuard, and fetchResolver are directly exported functional guards/resolver that inject() those tokens, matching the OKTA_AUTH/provideOktaAuth pattern already used for okta-auth-js. - Per-route token params are read from route.data.clientJs.params, mirroring the existing okta.guard.ts route.data.okta convention. - @okta/auth-foundation, @okta/oauth2-flows, and @okta/spa-platform are optional peer dependencies - existing okta-auth-js consumers are unaffected. - ESLint boundary rules (import/no-restricted-paths, no-restricted-imports) prevent lib/src from ever importing the new packages or lib/client-js. - Unit tests and README usage docs for the new subpath.
BenjaminTruong-okta
force-pushed
the
feat/client-js-opt-in-support
branch
from
September 2, 2026 22:13
8c4b793 to
9e2d10d
Compare
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
@okta/okta-angular/client-jssecondary entry point that wraps the beta@okta/okta-client-javascriptSDK (@okta/auth-foundation+@okta/oauth2-flows+@okta/spa-platform) in Angular's native router primitives, as an alternative to the existing@okta/okta-auth-js-based guards.provideClientJsAuth({ orchestrator, fetchClient })registers a consumer-constructed orchestrator/fetch client via theCLIENT_JS_ORCHESTRATOR/CLIENT_JS_FETCH_CLIENTinjection tokens, and the directly-exportedtokenGuard(CanActivateFn),loginCallbackGuard(CanActivateFn), andfetchResolverhelperinject()those tokens at call time — mirroring theOKTA_AUTH/provideOktaAuthpattern this repo already uses forokta-auth-js, rather than portingokta-react's factory/closure shape. Per-route token params are read fromroute.data.clientJs.params, the same conventionokta.guard.tsuses forroute.data.okta.lib/package.json. The default@okta/okta-angularentry point, and all existingokta-auth-js-based consumers, are completely unaffected.lib/.eslintrc.jsonaddsimport/no-restricted-paths(blockslib/srcimportinglib/client-js) andno-restricted-imports(blockslib/srcimporting@okta/auth-foundation/@okta/oauth2-flows/@okta/spa-platformdirectly) — verified by deliberately introducing and reverting a bad import to confirm the rule actually fires.lib/client-jssecondary entry point, optional peer deps, lint boundary) were informed byokta-react'sfeat/client-js-opt-in-supportbranch, but the guard/resolver/provider API itself was redesigned around idiomatic Angular DI rather than mirroring React Router's loader/factory structure, per review feedback that the initial pass leaned too heavily on the React SDK's shape.Test plan
yarn build— emitsdist/client-jswith a./client-jsentry in the rootdist/package.jsonexports mapyarn lint— confirmed the boundary rule fires on a deliberate bad import (then reverted), full suite passes cleanyarn test:unit— 68/68 passing, 100% coverage on the newclient-jsfilesNot included in this pass (by design, per scoping discussion): sample-app wiring in
test/apps/.