akveo / akveo/ngx-admin

Problem with NbPasswordAuthStrategy on ngx-admin

Abierto
#5,549 3 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
25.7k
Forks
7.9k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Issue type

**I'm submitting a ...** (check one with "x")

* [x] bug report
* [ ] feature request
* [ ] question about the decisions made in the repository

### Issue description
I have a problem using NbPasswordAuthStrategy implemented in the ngx-admin template because it doesn't show any errors but auth token is not saved.

**Current behavior:**
I implemented NbPasswordAuthStrategy with ngx-admin with my backend, the server is a nodejs using passport for security.
I am also using a custom Auth component for the login page just to be able to change some visuals.
The problem comes when I log in, the message of success appears but nothing happens. I also have configured the AuthGuard and when the AuthGuard calls isAuthenticated() function the result is false.

I don't know what's the problem, when I use my backend with postman security works just fine.

**Expected behavior:**
The expected behavior its saving the auth token so when calling isAuthenticated() functiion the result is true.

**Steps to reproduce:**
Implement custom auth login on the ngx-admin template using NbPasswordAuthStrategy.

My core.module.ts
```
strategies: [
NbPasswordAuthStrategy.setup({
name: 'email',
baseEndpoint: 'http://localhost:3700/api',
login: {
endpoint: '/auth/login',
method: 'post',
alwaysFail: false,
requireValidToken: false,
redirect: {
success: '/pages/inicio',
failure: null,
},
defaultErrors: ['Los datos no son correctos, por favor intente nuevamente.'],
defaultMessages: ['Sesión iniciada exitosamente.'],
},
register: {
endpoint: '/auth/register',
},
logout: {
alwaysFail: false,
endpoint: '/auth/logout',
method: 'get',
redirect: {
success: '/auth/login',
failure: null,
},
defaultErrors: ['Algo salio mal, intentalo nuevamente.'],
defaultMessages: ['Sesión cerrada exitosamente.'],
},
}),
],
}).providers,
```

### Other information:

**npm, node, OS, Browser**
node version: 10.16.3
npm version: 6.9.0
OS: Windows 10
Browser: Chrome/Edge/Vivaldi

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.