akveo / akveo/nebular

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

未关闭
#2,639 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
8.1k
派生
1.5k
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。