Angular Django REST Auth Interface

5.0.9 · abandoned · verified Wed Apr 22

tdn-auth is an Angular module designed to provide an interface for interacting with Django REST Auth backends. As of version 5.0.9, the package primarily targets Angular 5.x. It offers functionalities for authentication flows, including configuration overrides for base URLs and other parameters. The package has not seen updates since its last publish approximately 7 years ago, making it effectively abandoned. It is not compatible with modern Angular versions (Angular 6+) and is best suited for legacy Angular 5 applications. There is no active release cadence or ongoing development. Its key differentiator was providing a pre-built integration layer for a specific Django authentication framework at the time of its release.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import and initialize the `AuthModule` in an Angular application, including how to provide a custom configuration by extending `AuthConfig` to set the base URL for the Django REST Auth API.

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AuthModule } from 'tdn-auth';
import { Injectable } from '@angular/core';
import { AuthConfig } from 'tdn-auth/auth.config';

// Assuming you have an Angular environment file for configuration
const environment = {
  production: false,
  api_base_url: 'https://your-django-rest-auth-api.com/' // Replace with your Django REST Auth API base URL
};

@Injectable()
export class CustomAuthConfig extends AuthConfig {
    constructor() {
        super();
        this.base_url = environment.api_base_url;
        // Further customization, e.g., token names, endpoints
        // this.login_url = 'auth/jwt/create/';
        // this.token_name = 'access_token';
    }
}

@NgModule({
  imports: [
    BrowserModule,
    // ... other Angular modules like HttpClientModule for API calls
    AuthModule.forRoot(CustomAuthConfig) // Use AuthModule with your custom configuration
  ],
  providers: [],
  bootstrap: []
})
export class AppModule { }

view raw JSON →