[TW-4608] feat(auth): add multi-credential support for authentication#713
Merged
radenkovic merged 3 commits intomainfrom Mar 17, 2026
Merged
[TW-4608] feat(auth): add multi-credential support for authentication#713radenkovic merged 3 commits intomainfrom
radenkovic merged 3 commits intomainfrom
Conversation
- Introduced a new example demonstrating multi-credential authentication for Google and Microsoft providers. - Updated models to include `credentialId` for specifying credentials in authentication requests. - Enhanced the `Auth` resource to handle `credentialId` in OAuth URL generation. - Added tests to verify functionality of multi-credential authentication and URL generation with `credentialId`.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #713 +/- ##
=======================================
Coverage 98.60% 98.61%
=======================================
Files 35 35
Lines 791 793 +2
Branches 68 69 +1
=======================================
+ Hits 780 782 +2
Misses 11 11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
AaronDDM
approved these changes
Mar 16, 2026
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.
Multi-Credential Feature Implementation
Overview
This document summarizes the implementation of the multi-credential authentication feature in the Nylas Node.js SDK. The multi-credential feature allows customers to maintain multiple different provider credential sets (client_id/client_secret combinations) under a single Connector.
What is Multi-Credential?
Multi-credential enables:
How It Works
Connector Creation: When creating a Connector with provider credentials, a "default" credential record is automatically created and associated with that Connector.
Additional Credentials: Create multiple credential records under the same Connector using the Credentials CRUD API, each representing a different client_id/client_secret combo.
Credential Selection During Authentication:
credentialIdin the request body undersettingscredentialIdas a query parameter (whenresponse_typeis "code")credentialIdis specified, the connector's default credential is usedImplementation Changes
1. Model Updates
src/models/connectors.tsactiveCredentialId?: stringtoConnectorinterfaceactiveCredentialId?: stringtoUpdateConnectorRequestinterfacesrc/models/grants.tscredentialId?: stringtoGrantinterfaceCreateGrantRequest.settingsto supportcredentialIdsrc/models/auth.tscredentialId?: stringtoURLForAuthenticationConfiginterface2. Resource Updates
src/resources/auth.tsurlAuthBuilder()method to includecredential_idquery parameter when provided3. Test Coverage
tests/resources/auth.spec.tsAdded comprehensive tests for:
credentialIdparametercredentialIdparametercredentialIdin settingscredentialIdis not added when not providedUsage Examples
1. Create a Connector (Creates Default Credential)
2. Create Additional Credentials
3. Use Specific Credential in Hosted Auth
4. Use Specific Credential in Hosted Auth with PKCE
5. Use Specific Credential in Custom Auth
6. Update Connector's Default Credential
API Compatibility
Backward Compatibility
All changes are backward compatible:
credentialIdis not specified, the connector's default credential is usedResponse Fields
Responses now include credential information:
Grantobjects includecredentialIdfieldConnectorobjects includeactiveCredentialIdfieldTesting
All tests pass successfully:
Notes
credentialIdfor Microsoft