@beepbox.net/gofetch-client 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,13 +44,18 @@ await client.user.me({ headers: { Authorization: `Bearer ${token}` } })
|
|
|
44
44
|
|
|
45
45
|
## Auth
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
gofetch is a standalone API. Discord OAuth completes at `GET /v0/auth/discord/callback`, which returns JSON:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{ "accessToken": "<jwt>", "user": { ... } }
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Your app runs the login UX (redirect to `/v0/auth/discord`, handle the callback response, store the JWT). Then pass the token into the client:
|
|
48
54
|
|
|
49
55
|
```ts
|
|
50
|
-
const api = createClient({ token:
|
|
56
|
+
const api = createClient({ token: accessToken })
|
|
51
57
|
|
|
52
58
|
const { data: me } = await api.v1.user.me.get()
|
|
53
|
-
// me is fully typed (displayName, role, etc.)
|
|
54
59
|
```
|
|
55
60
|
|
|
56
61
|
Per-request headers also work:
|