Skip to content

Commit e22d82f

Browse files
Show how to use the Bearer token
1 parent 93c7541 commit e22d82f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,15 @@ const { data } = await axios.post("https://example.com/api/auth", {
5353
password: "coolpassword123",
5454
});
5555

56-
console.log(data.data.token);
56+
const token = data.data.token;
57+
```
58+
59+
You then use this token in all future API requests:
60+
61+
```js
62+
const { data } = await axios.get("https://example.com/api/user", {
63+
headers: { Authorization: `Bearer ${token}` },
64+
});
5765
```
5866

5967
## Development

0 commit comments

Comments
 (0)