{"id":13806511,"url":"https://github.com/auth0/auth0-angular","last_synced_at":"2026-01-16T06:55:48.939Z","repository":{"id":395942,"uuid":"278695320","full_name":"auth0/auth0-angular","owner":"auth0","description":"Auth0 SDK for Angular Single Page Applications","archived":false,"fork":false,"pushed_at":"2025-03-25T16:28:14.000Z","size":9054,"stargazers_count":190,"open_issues_count":19,"forks_count":63,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-04-06T19:09:34.499Z","etag":null,"topics":["angular","auth0","auth0-spa-js","authentication","dx-sdk","spa"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":"Unmaintained","scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/auth0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-10T17:33:33.000Z","updated_at":"2025-04-05T17:30:46.000Z","dependencies_parsed_at":"2023-09-23T04:28:18.006Z","dependency_job_id":"7504b04f-3885-4ff8-b749-e8eb25aa9bf7","html_url":"https://github.com/auth0/auth0-angular","commit_stats":{"total_commits":424,"total_committers":28,"mean_commits":"15.142857142857142","dds":0.6698113207547169,"last_synced_commit":"c97aace5543867a479942e2662b1f8868ed5b689"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fauth0-angular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fauth0-angular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fauth0-angular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fauth0-angular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/auth0","download_url":"https://codeload.github.com/auth0/auth0-angular/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248790638,"owners_count":21162064,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","auth0","auth0-spa-js","authentication","dx-sdk","spa"],"created_at":"2024-08-04T01:01:12.692Z","updated_at":"2026-01-16T06:55:48.930Z","avatar_url":"https://github.com/auth0.png","language":"TypeScript","readme":"![Auth0 SDK for Angular Single Page Applications](https://cdn.auth0.com/website/sdks/banners/auth0-angular-banner.png)\n\nA library for integrating [Auth0](https://auth0.com) into an Angular application.\n\n![Release](https://img.shields.io/npm/v/@auth0/auth0-angular)\n[![Codecov](https://img.shields.io/codecov/c/github/auth0/auth0-angular)](https://codecov.io/gh/auth0/auth0-angular)\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/auth0/auth0-angular)\n![Downloads](https://img.shields.io/npm/dw/@auth0/auth0-angular)\n[![License](https://img.shields.io/:license-MIT-blue.svg?style=flat)](https://opensource.org/licenses/MIT)\n[![CircleCI](https://img.shields.io/circleci/build/github/auth0/auth0-angular)](https://circleci.com/gh/auth0/auth0-angular)\n\n📚 [Documentation](#documentation) - 🚀 [Getting Started](#getting-started) - 💻 [API Reference](#api-reference) - 💬 [Feedback](#feedback)\n\n## Documentation\n\n- [Quickstart](https://auth0.com/docs/quickstart/spa/angular) - our interactive guide for quickly adding login, logout and user information to an Angular app using Auth0.\n- [Sample App](https://github.com/auth0-samples/auth0-angular-samples/tree/master/Sample-01) - a full-fledged Angular application integrated with Auth0.\n- [FAQs](https://github.com/auth0/auth0-angular/tree/main/FAQ.md) - frequently asked questions about the auth0-angular SDK.\n- [Examples](https://github.com/auth0/auth0-angular/tree/main/EXAMPLES.md) - code samples for common Angular authentication scenario's.\n- [Docs site](https://www.auth0.com/docs) - explore our docs site and learn more about Auth0.\n\n## Getting started\n\n### Requirements\n\nThis project only supports the [actively supported versions of Angular as stated in the Angular documentation](https://angular.dev/reference/releases#actively-supported-versions). Whilst other versions might be compatible they are not actively supported.\n\n### Installation\n\nUsing npm:\n\n```sh\nnpm install @auth0/auth0-angular\n```\n\nWe also have `ng-add` support, so the library can also be installed using the Angular CLI:\n\n```sh\nng add @auth0/auth0-angular\n```\n\n### Configure Auth0\n\nCreate a **Single Page Application** in the [Auth0 Dashboard](https://manage.auth0.com/#/applications).\n\n\u003e **If you're using an existing application**, verify that you have configured the following settings in your Single Page Application:\n\u003e\n\u003e - Click on the \"Settings\" tab of your application's page.\n\u003e - Scroll down and click on the \"Show Advanced Settings\" link.\n\u003e - Under \"Advanced Settings\", click on the \"OAuth\" tab.\n\u003e - Ensure that \"JsonWebToken Signature Algorithm\" is set to `RS256` and that \"OIDC Conformant\" is enabled.\n\nNext, configure the following URLs for your application under the \"Application URIs\" section of the \"Settings\" page:\n\n- **Allowed Callback URLs**: `http://localhost:4200`\n- **Allowed Logout URLs**: `http://localhost:4200`\n- **Allowed Web Origins**: `http://localhost:4200`\n\n\u003e These URLs should reflect the origins that your application is running on. **Allowed Callback URLs** may also include a path, depending on where you're handling the callback.\n\nTake note of the **Client ID** and **Domain** values under the \"Basic Information\" section. You'll need these values in the next step.\n\n### Configure the SDK\n\n#### Static configuration\n\nThe recommended approach is to use the functional `provideAuth0()` in your application configuration:\n\n```ts\nimport { ApplicationConfig } from '@angular/core';\nimport { provideAuth0 } from '@auth0/auth0-angular';\n\nexport const appConfig: ApplicationConfig = {\n  providers: [\n    provideAuth0({\n      domain: 'YOUR_AUTH0_DOMAIN',\n      clientId: 'YOUR_AUTH0_CLIENT_ID',\n      authorizationParams: {\n        redirect_uri: window.location.origin,\n      },\n    }),\n  ],\n};\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eUsing NgModules\u003c/summary\u003e\n\nIf you're using NgModules, you can configure the SDK using `AuthModule.forRoot()`:\n\n```ts\nimport { NgModule } from '@angular/core';\nimport { AuthModule } from '@auth0/auth0-angular';\n\n@NgModule({\n  imports: [\n    AuthModule.forRoot({\n      domain: 'YOUR_AUTH0_DOMAIN',\n      clientId: 'YOUR_AUTH0_CLIENT_ID',\n      authorizationParams: {\n        redirect_uri: window.location.origin,\n      },\n    }),\n  ],\n})\nexport class AppModule {}\n```\n\n\u003c/details\u003e\n\n#### Dynamic configuration\n\nInstead of providing static configuration, you can use `provideAppInitializer` to load your config from an external source before the SDK is instantiated, and configure it using `AuthClientConfig.set`.\n\n```ts\nimport { ApplicationConfig, inject, provideAppInitializer } from '@angular/core';\nimport { provideHttpClient, HttpBackend, HttpClient } from '@angular/common/http';\nimport { provideAuth0, AuthClientConfig } from '@auth0/auth0-angular';\n\nexport function configInitializer(handler: HttpBackend, config: AuthClientConfig) {\n  return () =\u003e\n    new HttpClient(handler)\n      .get('/config')\n      .toPromise()\n      .then((loadedConfig: any) =\u003e config.set(loadedConfig));\n}\n\nexport const appConfig: ApplicationConfig = {\n  providers: [\n    provideHttpClient(),\n    provideAuth0(),\n    provideAppInitializer(() =\u003e {\n      const handler = inject(HttpBackend);\n      const config = inject(AuthClientConfig);\n      return configInitializer(handler, config)();\n    }),\n  ],\n};\n```\n\n\u003e **Important:** The configuration will only be used initially when the SDK is instantiated. Any changes made to the configuration at a later moment in time will have no effect on the default options used when calling the SDK's methods. This is why the dynamic configuration should be set using an app initializer, which ensures the configuration is available prior to instantiating the SDK.\n\n\u003e :information_source: Any request made through an instance of `HttpClient` that got instantiated by Angular will use all configured interceptors, including our `AuthHttpInterceptor`. Because the `AuthHttpInterceptor` requires the existence of configuration settings, the request for retrieving those dynamic configuration settings should ensure it's not using any interceptors. In Angular, this can be done by manually instantiating `HttpClient` using an injected `HttpBackend` instance.\n\n\u003cdetails\u003e\n\u003csummary\u003eUsing NgModules\u003c/summary\u003e\n\nInstead of using `AuthModule.forRoot` to specify auth configuration, you can provide a factory function using `APP_INITIALIZER` to load your config from an external source before the auth module is loaded, and provide your configuration using `AuthClientConfig.set`.\n\n```ts\nimport { APP_INITIALIZER } from '@angular/core';\nimport { HttpClientModule, HttpClient, HttpBackend } from '@angular/common/http';\nimport { AuthModule, AuthClientConfig } from '@auth0/auth0-angular';\n\nfunction configInitializer(handler: HttpBackend, config: AuthClientConfig) {\n  return () =\u003e\n    new HttpClient(handler)\n      .get('/config')\n      .toPromise()\n      .then((loadedConfig: any) =\u003e config.set(loadedConfig));\n}\n\n@NgModule({\n  imports: [HttpClientModule, AuthModule.forRoot()],\n  providers: [\n    {\n      provide: APP_INITIALIZER,\n      useFactory: configInitializer,\n      deps: [HttpBackend, AuthClientConfig],\n      multi: true,\n    },\n  ],\n})\nexport class AppModule {}\n```\n\n\u003c/details\u003e\n\n### Add login to your application\n\nTo log the user into the application, inject the `AuthService` and call its `loginWithRedirect` method.\n\n```ts\nimport { Component } from '@angular/core';\nimport { AuthService } from '@auth0/auth0-angular';\n\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n  styleUrls: ['./app.component.css'],\n})\nexport class AppComponent {\n  constructor(public auth: AuthService) {}\n\n  loginWithRedirect() {\n    this.auth.loginWithRedirect();\n  }\n```\n\nBy default the application will ask Auth0 to redirect back to the root URL of your application after authentication. This can be configured by setting the [redirectUri](https://auth0.github.io/auth0-angular/interfaces/AuthorizationParams.html#redirect_uri) option.\n\nFor more code samples on how to integrate the **auth0-angular** SDK in your **Angular** application, including how to use our standalone and function APIs, have a look at the [examples](https://github.com/auth0/auth0-angular/tree/main/EXAMPLES.md).\n\n## API reference\n\nExplore public API's available in auth0-angular.\n\n- [AuthService](https://auth0.github.io/auth0-angular/classes/AuthService.html) - service used to interact with the SDK.\n- [AuthConfig](https://auth0.github.io/auth0-angular/interfaces/AuthConfig.html) - used to configure the SDK.\n\n## Feedback\n\n### Contributing\n\nWe appreciate feedback and contribution to this repo! Before you get started, please see the following:\n\n- [Auth0's general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)\n- [Auth0's code of conduct guidelines](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)\n\n### Raise an issue\n\nTo provide feedback or report a bug, please [raise an issue on our issue tracker](https://github.com/auth0/auth0-angular/issues).\n\n### Vulnerability Reporting\n\nPlease do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/responsible-disclosure-policy) details the procedure for disclosing security issues.\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png\"   width=\"150\"\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.auth0.com/website/sdks/logos/auth0_dark_mode.png\" width=\"150\"\u003e\n    \u003cimg alt=\"Auth0 Logo\" src=\"https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png\" width=\"150\"\u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003eAuth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout \u003ca href=\"https://auth0.com/why-auth0\"\u003eWhy Auth0?\u003c/a\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\nThis project is licensed under the MIT license. See the \u003ca href=\"https://github.com/auth0/auth0-angular/tree/main/LICENSE\"\u003e LICENSE\u003c/a\u003e file for more info.\u003c/p\u003e\n","funding_links":[],"categories":["Security and Authentication"],"sub_categories":["Authentication"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fauth0-angular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauth0%2Fauth0-angular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fauth0-angular/lists"}