akveo / akveo/nebular

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

Đang mở
#2,362 1 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")

* [ ] 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

```

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.