akveo / akveo/nebular

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

Aberta
#2,639 6 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
TypeScript
Estrelas
8.1k
Forks
1.5k
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.