Angular is a TypeScript-based framework for building web applications. This example demonstrates how to integrate Zitadel using the OAuth 2.0 PKCE flow to authenticate users securely and maintain sessions across your Angular application.
This Angular application showcases a complete authentication pattern using Zitadel with PKCE. Users begin on a public landing page where they can initiate sign-in with Zitadel's authorization server. After successful authentication, the app handles the OAuth callback and redirects users to a protected profile page displaying their user information and claims.
The application integrates authentication logic into Angular routing: protected routes use router guards to automatically redirect unauthenticated users to the sign-in flow, and callback routes complete the PKCE exchange and restore session state. The example requests standard OIDC scopes (openid, profile, email), offline_access for refresh tokens, and Zitadel-specific scopes for metadata and role information.
The example includes secure sign-out functionality implementing federated logout through Zitadel's end-session endpoint, which terminates both the local application session and the Zitadel session, then redirects the user back to the application.
Optionally enable refresh tokens in Token Settings for long-lived sessions
Note: Make sure to enable Dev Mode in the Zitadel Console if you're using HTTP URLs during local development. For production deployments, always use HTTPS URLs and disable Dev Mode.
Create a .env file (copy from .env.example) and configure it with the values from your Zitadel application. Use these environment variable names exactly as shown: