Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new JavaScript/TypeScript example intended to demonstrate a “custom authenticator” pattern (token vending from a backend + client-side token caching) to avoid exposing a long-lived projectKey to untrusted clients.
Changes:
- Introduces a combined backend/client end-to-end script for token delegation.
- Implements a
BackendTokenAuthenticatorwith local token caching. - Adds an in-process HTTP token server used by the example client.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+78
to
+82
| // Delegate to MossClient — no need to re-implement the token exchange | ||
| const authToken = await mossClient.getAuthToken(); | ||
|
|
||
| res.writeHead(200, { 'Content-Type': 'application/json' }); | ||
| res.end(JSON.stringify(authToken)); // { token: string, expiresIn: number } |
There was a problem hiding this comment.
MossClient currently has no getAuthToken() method in this repo’s JS SDK (sdks/javascript/sdk/src/client/mossClient.ts), so this backend token-vending endpoint won’t compile/run as written. Use the SDK’s actual authentication mechanism, or add a supported token-exchange API to the SDK and update the sample accordingly.
HarshaNalluru
approved these changes
Apr 17, 2026
Atulsingh1155
pushed a commit
to Atulsingh1155/moss
that referenced
this pull request
Apr 30, 2026
## Pull Request Checklist Please ensure that your PR meets the following requirements: - [ ] I have read the [CONTRIBUTING](CONTRIBUTING.md) guide. - [ ] I have updated the documentation (if applicable). - [ ] My code follows the style guidelines of this project. - [ ] I have performed a self-review of my own code. - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] New and existing unit tests pass locally with my changes. ## Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. Fixes # (issue number) ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/usemoss/moss/pull/154" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end -->
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.
Pull Request Checklist
Please ensure that your PR meets the following requirements:
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
Fixes # (issue number)
Type of Change