# 2.0.0-rc.8-2.0.0-rc.9 Auth Migration

Multiple breaking changes introduced to Auth Module during this update to improve code readability, 
follow better naming conventions and for better extensibility in future releases.

Here are the steps to migrate:

###### 1. Change imports to new correct strategy names:

- `NbDummyAuthProvider` -> `NbDummyAuthStrategy`
- `NbEmailPassAuthProvider` -> `NbPasswordAuthStrategy` (could be used not only with `email`)
- `NbAbstractAuthProvider` -> `NbAuthStrategy`


###### 2. Change auth forms configuration `provider` key to `strategy`, so instead of 

```ts
`NbAuthModule.forRoot({
  forms: {
     login: {
       provider: 'email',
     },
  },
})`
```

should be:
```ts
`NbAuthModule.forRoot({
  forms: {
     login: {
       strategy: 'email', // provider -> strategy
     },
  },
})` 
```

###### 3. Register strategies through special `setup` method, so instead of the `providers` object, 
where object key - is a strategy name and value is a configuration:  

```ts
providers: {
  email: {
    service: NbEmailPassAuthProvider,
    config: { ... }
  }
}
```

should be an array (called `strategies`) which accepts the result of a call of `setup` method of a strategy,
which in its turn accepts a configuration, with a `name` key.

```ts
strategies: [
  NbPasswordAuthStrategy.setup({ name: 'email', ... }),
]
```

Strategy configuration is type-checked now.

###### 4. Remove `NB_AUTH_TOKEN_CLASS` imports and usage.
Token class is passed through strategy configuration, like this:

```ts
@NgModule({
  imports: [
   // ...

   NbAuthModule.forRoot({
         strategies: [
           NbPasswordAuthStrategy.setup({
             name: 'email',

             token: {
               class: NbAuthJWTToken,  // <----
             }
           }),
         ],
       }),
  ],
});
```

In case you have a custom token - add `NAME` static property.
