akveo / akveo/nebular

NbPasswordAuthStrategy not calling refresh endpoint

Abierto
#2,655 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
8.1k
Forks
1.5k
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

### Issue description

I am developing a web app based on ngx-admin. I cloned the basic branch and started modifying the Authentication system to make it work with my auth server.
My auth server sends back at login a JWT and a HTTPOnly cookie with a refresh token. I have then a refresh_token API to refresh the JWT with the refresh token.
I am using NbPasswordAuthStrategy. I saw there's a way to automatically refresh the token with the strategy as seen here https://akveo.github.io/nebular/docs/auth/nbpasswordauthstrategy#nbpasswordauthstrategy

**Current behavior:**

JWT works perfectly. I created a simple interceptor to add withCredentials: true to every request so I can send the httponly cookie at every request. This works perfectly too. But...
I configured the refreshToken property in the NbStrategy but it is never called, so obviously I never get my token refreshed. Am I missing something or something is not working?

**Expected behavior:**
Refresh token endpoint gets called automatically

**Related code:**

This is my strategy

```
NbAuthModule.forRoot({
strategies: [
NbPasswordAuthStrategy.setup({
{
baseEndpoint = '/api/auth/';
login: {
endpoint: 'login',
method: 'post',
redirect: {
success: '/home',
failure: null,
},
};
logout: {
endpoint: 'logout',
method: 'post',
redirect: {
success: '/login',
failure: null,
},
};
refreshToken: {
endpoint: 'refresh_token',
method: 'post',
requireValidToken: true,
redirect: {
success: null,
failure: null,
},
};
token: {
class: NbAuthJWTToken,
key: 'accessToken',
};
...........

```

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.