-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-tokens
29 lines (24 loc) · 1.01 KB
/
test-tokens
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const secret: string | undefined = 'sssssss';
const token2 = jwt.sign('{name: "test"}', secret);
eyJhbGciOiJIUzI1NiJ9.e25hbWU6ICJ0ZXN0In0.91dNWp93vbDeIPmC4ntVCQKTtZdbKbWwq_nCbc1tSQg
eyJhbGciOiJIUzI1NiJ9.e25hbWU6ICJ0ZXN0In0.91dNWp93vbDeIPmC4ntVCQKTtZdbKbWwq_nCbc1tSQg
eyJhbGciOiJIUzI1NiJ9.eyJuYW1lIjogInRlc3QifQ.ZjaPq6Ow34G3cBXBU-eOE9IJzK0W5uWyI6BZC7RqpUU
fetch('http://localhost:5000/', {
method: 'post',
headers: new Headers({
'Authorization': 'Basic eyJhbGciOiJIUzI1NiJ9.e25hbWU6ICJ0ZXN0In0.91dNWp93vbDeIPmC4ntVCQKTtZdbKbWwq_nCbc1tSQg',
'Content-Type': 'application/json'
}),
body: 'A=1&B=2'
});
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer eyJhbGciOiJIUzI1NiJ9.e25hbWU6ICJ0ZXN0In0.91dNWp93vbDeIPmC4ntVCQKTtZdbKbWwq_nCbc1tSQg");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("localhost:5000", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));