akveo / akveo/nebular

How can we decode jwt token and set those value in local storage

Abierto
#2,362 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")

* [ ] bug report
* [x] feature request

### Issue description

**Current behavior:**

When I get a jwt token from my API, it is automatically set in local storage under key **auth_app_token**

**Expected behavior:**

My query is- How can we decode the token we get and store those internal values inside the **auth_app_token**?

**Steps to reproduce:**

Steps to reproduce are basic steps for authentication with token class **NbAuthJWTToken**

**Related code:**

When I get the token, what I want to do is-
```
token.decode(token.getValue()) // this will give me what token consists of
{
"sub": "1234567890",
"name": "John Doe",
"iat": 1516239022,
"role": "superuser"
}
```
and this I can set to local storage.

Also while clearing I want to clear this data.
### Other information:

**npm, node, OS, Browser**
```

```

**Angular, Nebular**
```
Angular: 9.0.4
Nebular: 5.0.0

```

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.