feat(auth): add smtpRequired option to enforce SMTP settings during I…#702
Merged
radenkovic merged 1 commit intomainfrom Feb 24, 2026
Merged
feat(auth): add smtpRequired option to enforce SMTP settings during I…#702radenkovic merged 1 commit intomainfrom
radenkovic merged 1 commit intomainfrom
Conversation
…MAP authentication
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #702 +/- ##
=======================================
Coverage 98.60% 98.60%
=======================================
Files 35 35
Lines 789 791 +2
Branches 67 68 +1
=======================================
+ Hits 778 780 +2
Misses 11 11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
AaronDDM
reviewed
Feb 18, 2026
Collaborator
AaronDDM
left a comment
There was a problem hiding this comment.
Add a change log please
AaronDDM
approved these changes
Feb 18, 2026
Merged
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.
Add
smtpRequiredOption for Hosted AuthenticationSummary
Adds support for the
smtp_requiredoption in hosted authentication URLs. This option has been available in the Nylas API since March 2025 but was not previously exposed in the Node SDK.What Changed
src/models/auth.ts): AddedsmtpRequired?: booleanproperty toURLForAuthenticationConfigsrc/resources/auth.ts): UpdatedurlAuthBuilderto appendoptions=smtp_requiredquery parameter whensmtpRequiredistruetests/resources/auth.spec.ts): Added test coverage for the new optionWhy This Matters
When authenticating IMAP users, SMTP settings are optional by default. This can lead to grants that appear valid but fail when sending emails with the error:
By setting
smtpRequired: true, the authentication flow proactively validates SMTP configuration upfront, preventing these runtime errors.Usage
This option works with:
urlForOAuth2()- Standard OAuth flowurlForOAuth2PKCE()- OAuth with PKCEurlForAdminConsent()- Microsoft admin consent flowReference
Nylas Support: How can I ensure users enter their SMTP settings during authentication
Test Results
All tests passing:
options=smtp_requiredwhensmtpRequired: trueoptionsparameter whensmtpRequiredis not setauth.tsNote
Low Risk
Small, additive change limited to URL query construction plus tests; low risk aside from potential behavior changes for callers who start opting into the new parameter.
Overview
Adds a new
smtpRequired?: booleanoption toURLForAuthenticationConfigand wires it into hosted auth URL generation sourlForOAuth2(and any flows using the shared builder, e.g. PKCE/admin consent) can appendoptions=smtp_required.Expands auth URL-building tests to assert the
optionsquery param is included only whensmtpRequiredis set and omitted otherwise.Written by Cursor Bugbot for commit c85ba1d. This will update automatically on new commits. Configure here.