akveo / akveo/ngx-admin

Problem with NbPasswordAuthStrategy on ngx-admin

Đang mở
#5,549 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
25.7k
Fork
7.9k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.