Angular Token screenshot

Angular Token

Author Avatar Theme by Neroniaky
Updated: 20 Jun 2022
368 Stars

:key: Token based authentication service for Angular with interceptor and multi-user support. Works best with devise token auth for Rails. Example:

Categories

Overview:

Angular-Token is a token-based authentication service for Angular that comes with an interceptor and multi-user support. It is designed to work seamlessly with the devise token auth gem for Rails, providing a secure authentication solution for Angular applications.

Features:

  • Token-based Authentication: Enables secure user authentication using tokens.
  • Interceptor Support: Includes an interceptor for seamless integration with HTTP requests.
  • Multi-User Support: Supports authentication for multiple users.
  • Easy Integration: Works effectively with the devise token auth gem for Rails.
  • Contributors: Developed by Jan-Philipp Riethmacher and Arjen Brandenburgh.
  • License: Distributed under the MIT License for open-source usage.

Installation:

To install Angular-Token, follow these steps:

  1. Set up a Rails backend with Devise Token Auth.
  2. Install Angular-Token via npm:
    npm install angular-token
    
  3. Import and add AngularTokenModule to your main Angular module. Ensure that HttpClientModule is also imported:
    import { AngularTokenModule } from 'angular-token';
    import { HttpClientModule } from '@angular/common/http';
    
    @NgModule({
      imports: [
        AngularTokenModule.forRoot({
          // Add your configuration here
        }),
        HttpClientModule
      ]
    })
    export class AppModule { }
    
  4. (Optional) Fix injection context runtime error: If you encounter an ‘inject() must be called from an injection context’ error after installation, add the following to your typescript path config in the tsconfig[.app].json file:
    "paths": {
      "@angular/*": [
        "node_modules/@angular/*"
      ],
      ...
    }
    

Summary:

Angular-Token is a powerful authentication service for Angular applications, offering token-based authentication, interceptor support, and multi-user capabilities. With seamless integration with Rails’s devise token auth gem, it provides a robust and secure solution for user authentication. The library is easy to install and use, making it a valuable tool for developing secure Angular applications.