[TW-4786] feat(admin): add callback URI CRUD and fix auth config#43
Merged
qasim-nylas merged 1 commit intomainfrom Apr 4, 2026
Merged
[TW-4786] feat(admin): add callback URI CRUD and fix auth config#43qasim-nylas merged 1 commit intomainfrom
qasim-nylas merged 1 commit intomainfrom
Conversation
…nfig
Fix `nylas auth config` callback URI creation which was using the wrong
API endpoint (PATCH /v3/applications/{appID}), and add full CRUD
management commands at `nylas admin callback-uris`.
API endpoints verified and implemented:
- GET /v3/applications/callback-uris (list)
- GET /v3/applications/callback-uris/:id (get)
- POST /v3/applications/callback-uris (create)
- PATCH /v3/applications/callback-uris/:id (update)
- DELETE /v3/applications/callback-uris/:id (delete)
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
nylas auth configcallback URI creation — was using brokenPATCH /v3/applications/{appID}endpoint, now uses dedicatedPOST /v3/applications/callback-urisnylas admin callback-uris(aliases:callbacks,cb) for managing OAuth redirect endpointsProblem
nylas auth configwas failing to create callback URIs because it usedPATCH /v3/applications/{appID}with a rebuiltcallback_urisarray. The Nylas v3 API has dedicated callback URI endpoints that are the correct way to manage these resources.API Endpoints Verified
GET/v3/applications/callback-urisGET/v3/applications/callback-uris/:idPOST/v3/applications/callback-urisPATCH/v3/applications/callback-uris/:idDELETE/v3/applications/callback-uris/:idNew CLI Commands
Changes
Fix:
nylas auth config(internal/cli/auth/config.go)ListCallbackURIsto check if URI already existsCreateCallbackURIto add it via the dedicated endpointselectedApp— works as long as config is loadedDomain (
internal/domain/)admin.go— AddedCreateCallbackURIRequest,UpdateCallbackURIRequesttypeserrors.go— AddedErrCallbackURINotFoundsentinel errorPort (
internal/ports/admin.go)AdminClientinterface:ListCallbackURIs,GetCallbackURI,CreateCallbackURI,UpdateCallbackURI,DeleteCallbackURIAdapter (
internal/adapters/nylas/)admin.go— HTTP implementations for all 5 endpoints with proper validationmock_admin.go— Mock stubs for testingdemo_admin.go— Demo mode stubsCLI (
internal/cli/admin/)admin.go— Registeredcallback-urissubcommandcallback_uris.go— Full CRUD commands (list, show, create, update, delete)Tests
admin_callback_uris_test.go(adapter) — 11 tests: happy paths, empty results, empty ID validation, server errors, not-foundcallback_uris_test.go(CLI) — 6 tests: command structure, flags, aliases, defaultsadmin_callback_uris_test.go(integration) — 5 tests: help, list, JSON, full CRUD lifecycle, aliasadmin_test.go— Updated expected subcommands to includecallback-urisDocs
docs/COMMANDS.md— Added callback URIs to admin command referencedocs/commands/admin.md— Full section with usage examples, flags, and note aboutauth configauto-creationTest plan
go build ./...passesgo vet ./...passesgo test ./internal/adapters/nylas/... ./internal/cli/admin/...nylas admin callback-uris list— table output worksnylas admin callback-uris list --json— valid JSON outputnylas admin cb list— alias worksgo test -tags integration ./internal/cli/integration/... -run CallbackURIJIRA: TW-4786 (linked to Epic TW-4638 — Nylas CLI)