Labsco
auth0 logo

auth0-angular

β˜… 37

by auth0 Β· part of auth0/agent-skills

Use when adding authentication to Angular applications with route guards and HTTP interceptors - integrates @auth0/auth0-angular SDK for SPAs

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup
🧩 One of 7 skills in the auth0/agent-skills package β€” works on its own, and pairs well with its siblings.

Use when adding authentication to Angular applications with route guards and HTTP interceptors - integrates @auth0/auth0-angular SDK for SPAs

Inspect the full instructions your agent will receiveExpand

This is the exact playbook injected into your agent when the skill activates β€” shown here so you can audit it before installing. You don't need to read it to use the skill.

by auth0

Use when adding authentication to Angular applications with route guards and HTTP interceptors - integrates @auth0/auth0-angular SDK for SPAs npx skills add https://github.com/auth0/agent-skills --skill auth0-angular Download ZIPGitHub37

Auth0 Angular Integration

Add authentication to Angular applications using @auth0/auth0-angular.

When NOT to Use

  • AngularJS (1.x) - This SDK requires Angular 13+, use legacy solutions for AngularJS

  • Mobile applications - Use auth0-react-native for React Native or native SDKs for Ionic

  • Backend APIs - Use JWT validation middleware for your server language

Welcome, {{ user.name }}!

Logout

Login

` }) export class AppComponent { constructor(public auth: AuthService) {}

login(): void { this.auth.loginWithRedirect(); }

logout(): void { this.auth.logout({ logoutParams: { returnTo: window.location.origin } }); } }

Copy & paste β€” that's it

### 5. Test Authentication

 Start your dev server and test the login flow:

ng serve

Copy & paste β€” that's it

## Detailed Documentation

- **[Setup Guide](https://github.com/auth0/agent-skills/blob/main/plugins/auth0/skills/auth0-angular/references/setup.md)** - Automated setup scripts (Bash/PowerShell), CLI commands, manual configuration 

- **[Integration Guide](https://github.com/auth0/agent-skills/blob/main/plugins/auth0/skills/auth0-angular/references/integration.md)** - Protected routes with guards, HTTP interceptors, error handling 

- **[API Reference](https://github.com/auth0/agent-skills/blob/main/plugins/auth0/skills/auth0-angular/references/api.md)** - Complete SDK API, configuration options, services reference, testing strategies

## Related Skills

- `auth0-quickstart` - Basic Auth0 setup 

- `auth0-migration` - Migrate from another auth provider 

- `auth0-mfa` - Add Multi-Factor Authentication 

- `auth0-cli` - Manage Auth0 resources from the terminal

## Quick Reference

**Core Services:**

 

- `AuthService` - Main authentication service 

- `isAuthenticated$` - Observable check if user is logged in 

- `user$` - Observable user profile information 

- `loginWithRedirect()` - Initiate login 

- `logout()` - Log out user 

- `getAccessTokenSilently()` - Get access token manually (alternative to HTTP interceptor) 

 **Common Use Cases:**

 

- Login/Logout buttons β†’ See Step 4 above 

- Protected routes with guards β†’ [Integration Guide](https://github.com/auth0/agent-skills/blob/main/plugins/auth0/skills/auth0-angular/references/integration.md#protected-routes) 

- Calling a protected API β†’ [Integration Guide](https://github.com/auth0/agent-skills/blob/main/plugins/auth0/skills/auth0-angular/references/integration.md#calling-a-protected-api) 

- Error handling β†’ [Integration Guide](https://github.com/auth0/agent-skills/blob/main/plugins/auth0/skills/auth0-angular/references/integration.md#error-handling)

## References

- [Auth0 Angular SDK Documentation](https://auth0.com/docs/libraries/auth0-angular) 

- [Auth0 Angular Quickstart](https://auth0.com/docs/quickstart/spa/angular) 

- [SDK GitHub Repository](https://github.com/auth0/auth0-angular)