<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged auth0challengagent</title>
<link>https://coderlegion.com/tag/auth0challengagent</link>
<description>Powered by Question2Answer</description>
<item>
<title>Building Anzen: What I Learned About Token Vault the Hard Way</title>
<link>https://coderlegion.com/16508/building-anzen-what-i-learned-about-token-vault-the-hard-way</link>
<description>&lt;p&gt;When I started building Anzen for the Authorised to Act hackathon, I thought Token Vault would be the easy part. I was wrong.&lt;/p&gt;
&lt;p&gt;The concept is simple and powerful: instead of your AI agent holding OAuth tokens for GitHub, Gmail, and Slack, Auth0 holds them in a secure vault. The agent requests a scoped token when it needs one, uses it, and the token is gone. No credentials stored in your app. No breach risk. No all-or-nothing access.&lt;/p&gt;
&lt;p&gt;The implementation is where it gets interesting. The first thing I discovered is that nextjs-auth0 v4 is a completely different SDK from v3. The familiar handleAuth function is gone. The middleware file convention changed. Environment variable names changed. Even the callback URL path changed from /api/auth/callback to /auth/callback. None of this was obvious from the documentation.&lt;/p&gt;
&lt;p&gt;The second discovery was about the token exchange flow itself. Calling getAccessToken() returns an Auth0 JWT — not the GitHub or Slack token you actually need. To get the provider token, you have to make a separate POST to the token endpoint using grant_type: urn:ietf:params:oauth:grant-type:token-exchange with specific subject and requested token type parameters. This is the Token Vault exchange, and getting those parameters exactly right took significant debugging.&lt;/p&gt;
&lt;p&gt;The third discovery was Groq compatibility. Zod schemas include a $schema meta-field in their JSON output that Groq's API rejects, causing silent &quot;Failed to call a function&quot; errors. The fix was switching from Zod to jsonSchema() from the AI SDK.&lt;/p&gt;
&lt;p&gt;Despite these challenges, the architecture we ended up with is exactly what AI agents should look like: zero credentials in the app, scoped access per action, and a user who stays in control at every step. That's the promise of Token Vault, and it's worth the difficulty of getting there.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/16508/building-anzen-what-i-learned-about-token-vault-the-hard-way</guid>
<pubDate>Sun, 03 May 2026 10:47:33 +0000</pubDate>
</item>
</channel>
</rss>