akveo / akveo/nebular

Nebular Auth Unable to pass in Refresh Token (JWT - DRF Djoser backend)

Đang mở
#2,639 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
8.1k
Fork
1.5k
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
* [x] feature request

### Issue description
I am using Nebular library as part of front end and Django Rest Framework + Djoser + JWT as part of backend.
I am facing issues with refresh token.
Djoser+JWT sends token in the form
```
{
"access": "Access_Token",
"refresh": "Refresh_Token"
}
```
and my configuration for Auth Module is as follows

```
...NbAuthModule.forRoot({
strategies: [
NbPasswordAuthStrategy.setup({
name: 'email',
token: {
class: NbAuthJWTToken,
key: 'access', // This telss NbAuthModule how token is passed in by API
},
baseEndpoint: environment.SERVER_API_URL,
login: {
endpoint: 'auth/jwt/create',
method: 'post',
},
logout: {
redirect: {
success: '/landing',
},
},
refreshToken:{
endpoint:'auth/jwt/refresh',
method:'post',
},
}),
],
.....
});
```
I am facing two issues

1. When trying to refresh Token, Djoser expects refresh token to be passed in as part of body. when making a post request to end point `/auth/jwt/refresh`
2. Since the token is returned in the form :
```
{
"access": "Access_Token",
"refresh": "Refresh_Token"
}
```
How can I save the refresh part of the token and access it using NbPasswordAuthStrategy?

I also found similar issue opened #1341 however there was no definitive response and issue was closed by user.

Any pointers would be highly appreciated

@nnixaa @yggg I would appreciate it if this would be addressed in future releases of Auth module.

### Other information:

**npm, node, OS, Browser**
```
Node: 13.14.0
npm: 6.14.10
OS: Ubuntu 20.04
Browser: Chrome/Firefox
```

**Angular, Nebular**
```
Nebular: 6.2.1
Angular: 10.0.1
```

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.