#Generated CLI is not detecting Auth from Collection
14 messages · Page 1 of 1 (latest)
Hey @craggy mortar 👋 I’m Kapa, your AI teammate here in Postman’s Discord. I’ll dig into our knowledge base to fine the best answer for you. Hang tight a sec while I look that up.
This is a known area of configuration that can trip people up. The generated CLI's authentication support depends on how the SDK configuration is set up, not just the collection's auth settings.
Here's what to check:
1. Verify your postman-sdk.config.json includes an auth setting
The auth field in your SDK config file is optional — if it's not set, the generated SDK/CLI won't include any authentication. You need to explicitly define it. For example:
{
...
"auth": [
"apikey"
]
...
}
Valid values are apikey, basic, bearer, custom, and oauth. [SDK auth config]
2. Re-initialize your config if needed
If you haven't set up the config file yet, you can create or update it using:
postman sdk init
This will walk you through setting up the .postman/config.json file. [SDK CLI commands]
3. Regenerate after updating the config
Once the auth field is correctly set in your config, regenerate the CLI:
postman sdk generate <id or path> --language cli
After regeneration, the CLI should include the setup-auth command with subcommands for each configured authentication method. [CLI generation overview]
In summary, the CLI generator does not automatically infer auth from the collection's auth settings — you need to explicitly configure it in the SDK config file. If you've already done this and the setup-auth command is still missing, it may be worth reaching out to Postman support, as the knowledge sources don't describe a specific bug related to this behavior.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@craggy mortar I’m always learning. If my answer helped (or missed the mark), let me know by reacting below. Your feedback helps me improve so I can support you and the community even better.
Hey @craggy mortar Can you provide some more context about how you have created that and what the output is?
The more information you provide, it will be easier for the team to check to see what's happening.
Hey Danny, thanks for the reply and apoligies for the delay! What would be the best format to share it? It's sensitive info
@mild heart Hey Hope you had a great weekend. Just wanted to update you and say that I generated a few other SDKs and CLIs for from swagger docs and the CLIs had the setup-auth wired correctly. I might've bugged the first one out somehow.
Ah cool, that's great news!! Apologies for not getting back to you sooner, I was working through my list 😅
If you have any issues in the future, please do raise more questions.
I'd also love to see you share more about how you're using the SDK and CLI - I think it would be something super interesting to share with the rest of the community in Discord. 🙏
No worries at all! Just posted in #general-chat btw. for sure! I'm actually really digging this feature because I mainly build tools for AI in the form of CLIs, MCPs, and Skills. The SDKs are being used in a Cloudflare MCP using a codemode tool so the agent can access them very easily without any context bloating!
@mild heart Thanks for the replies and for raising it with the team! I'll be glad to share more about it after I deliver it to the client
Hey @craggy mortar can I introduce you to @karmic sorrel - They will have a billion percent more context here than I ever will on the feature. 🙏
Hey @craggy mortar I saw and responded to your message in general chat already, but I wanted to say hi here as well. The CLI is currently in beta and we are very actively working on it, so you might see little improvements like that over time 😃 .
That being said, we would really like your feedback on the CLI so we can make it better for you and other developers. Especially when it comes to AI use cases, hence why we included SKILL.md files. Would be happy to talk more here or move it to DMs!