LeoYeAI/agent-master-skills / skills/azure-auth
azure-auth
VerifiedMicrosoft Entra ID (Azure AD) authentication for React SPAs with MSAL.js and Cloudflare Workers JWT validation using jose library. Full-stack pattern with Authorization Code Flow + PKCE. Prevents 8 documented errors. Use when: implementing Microsoft SSO, troubleshooting AADSTS50058 loops, AADSTS700084 refresh token errors, React Router redirects, setActiveAccount re-render issues, or validating Entra ID tokens in Workers.
| File | Kind | Size |
|---|---|---|
| .claude-plugin/plugin.json | config | 688 B |
| README.md | markdown | 2.5 KB |
| SKILL.md | skill md | 19.7 KB |
| _meta.json | config | 284 B |
| references/aadsts-error-codes.md | markdown | 7.7 KB |
| rules/azure-auth.md | markdown | 3.4 KB |
| templates/msal-config.ts | script | 2.9 KB |
| templates/msal-provider.tsx | other | 4.5 KB |
| templates/protected-route.tsx | other | 7.1 KB |
| templates/use-api-token.ts | script | 6.0 KB |
| templates/workers-jwt-validation.ts | script | 8.3 KB |
README.md
View on GitHub# azure-auth
Microsoft Entra ID (Azure AD) authentication for React SPAs + Cloudflare Workers backend.
## Auto-Trigger Keywords
This skill activates when you mention:
### Technologies
- Azure AD, Azure Active Directory, Microsoft Entra ID, Entra ID
- MSAL, MSAL.js, msal-react, msal-browser, @azure/msal-react, @azure/msal-browser
- Microsoft authentication, Microsoft SSO, Microsoft login
- Azure B2C, Entra External ID
### Use Cases
- Microsoft SSO, Azure SSO, corporate SSO, enterprise SSO
- Office 365 login, Microsoft 365 authentication
- Azure AD token validation, Entra token validation
- JWT validation Azure, validate Azure token
- JWKS Azure, Azure AD JWKS
### Errors
- AADSTS50058, AADSTS700084, AADSTS65001, AADSTS90102
- no_cached_authority_error
- interaction_in_progress
- redirect loop MSAL, infinite loop MSAL
- acquireTokenSilent failed
- refresh token expired SPA
### Patterns
- Azure AD React, MSAL React setup
- Azure AD Cloudflare Workers
- MsalProvider, PublicClientApplication
- Authorization Code Flow PKCE Azure
- Multi-tenant Azure AD
## What This Skill Provides
1. **MSAL React Setup** - Configuration, provider, hooks
2. **Protected Routes** - Auth-gated components with proper loading states
3. **Token Acquisition** - Silent + interactive fallback patterns
4. **Workers JWT Validation** - jose-based validation (MSAL doesn't work in Workers)
5. **Error Prevention** - AADSTS codes, redirect loops, JWKS quirks
6. **Multi-Tenant Support** - Single vs multi-tenant patterns
## Key Files
- `SKILL.md` - Complete documentation
- `templates/msal-config.ts` - MSAL configuration
- `templates/msal-provider.tsx` - React provider setup
- `templates/protected-route.tsx` - Auth-protected component wrapper
- `templates/workers-jwt-validation.ts` - Cloudflare Workers token validation
- `rules/azure-auth.md` - Correction rules for common mistakes
- `references/aadsts-error-codes.md` - Error code reference
## Critical Notes
1. **MSAL.js does NOT work in Cloudflare Workers** - Use jose library for backend
2. **Azure AD JWKS URL is non-standard** - Fetch from openid-configuration first
3. **SPA refresh tokens expire in 24 hours** - Handle InteractionRequiredAuthError
4. **storeAuthStateInCookie: true** - Required for Safari/Edge compatibility
5. **Azure AD B2C sunset (complete, May 2025)** - Use Entra External ID for new consumer apps
6. **ADAL retirement (complete, Sept 2025)** - Migrate from ADAL to MSAL; no more security updates
## Package Versions
```json
{
"@azure/msal-react": "3.0.23",
"@azure/msal-browser": "4.27.0",
"jose": "5.9.6"
}
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |