title: Angular resetting csrf token
body: <p>I'm using Angular 6 and having a hard time integrating Django's csrf with Angular's.
  I found <a href="https://stackoverflow.com/questions/18156452/django-csrf-token-angularjs">in this thread</a> that Django changes the token on login which, since I can both register and login using post requests with the same new session but not post anything after login seems to make sense.</p>
  
  <p>The question becomes how I go about resetting the csrf token on login. The way the csrf is handled now in my Angular app is shown in the below code for my app module:</p>
  
  <pre><code>import { BrowserModule } from '@angular/platform-browser';
  import { FormsModule, ReactiveFormsModule } from '@angular/forms';
  import { NgModule } from '@angular/core';
  import { HttpClientModule } from '@angular/common/http';
  import { HttpModule, XSRFStrategy, CookieXSRFStrategy } from '@angular/http'
  
  import { AppComponent } from './app.component';
  import { AppRoutingModule } from './app-routing.module';
  import { RegisterComponent } from './register/register.component';
  import { LoginComponent } from './login/login.component';
  import { AlertComponent } from './_directives/alert.component';
  import { ProfileComponent } from './profile/profile.component';
  import { AuthGuardService } from './_guards/auth-guard.service';
  import { AlertService } from './_services/alert.service';
  import { AuthService } from './_services/auth.service';
  import { UserService } from './_services/User.service';
  
  @NgModule({
    declarations: [
      AppComponent,
      RegisterComponent,
      LoginComponent,
      AlertComponent,
      ProfileComponent,
    ],
    imports: [
      BrowserModule,
      FormsModule,
      ReactiveFormsModule,
      AppRoutingModule,
      HttpClientModule,
      HttpModule
    ],
    providers: [
      {
        provide: XSRFStrategy,
        useValue: new CookieXSRFStrategy('csrftoken', 'X-CSRFToken')
      }
    ],
    bootstrap: [AppComponent]
  })
  export class AppModule { }
  </code></pre>
  
  <p>So my question is, how do I get my app to reset the value on login? (Not necessarily specifically login, but how do I get that value to reset.)</p>