Skip to content

Commit b76bd5f

Browse files
committed
Clean up known error types
1 parent 24904b1 commit b76bd5f

9 files changed

Lines changed: 370 additions & 156 deletions

File tree

packages/oauth/client/README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,22 @@ const { url } = await client.authorize();
3838
const params = new URLSearchParams(req.url.split("?")[1]);
3939
const { access_token } = await client.callback(params, "user-session");
4040

41-
// Later, grab or refresh the stored session
42-
const storedToken = await client.getSession("user-session");
43-
const { access_token: refreshedAccessToken } = await client.refreshSession(
44-
"user-session"
45-
);
41+
// Later, restore the stored session with the same key.
42+
// `restoreSessionForId()` refreshes the access token automatically when needed.
43+
// If the session key is missing, it returns `undefined`.
44+
const storedToken = await client.restoreSessionForId("user-session");
4645

4746
if (storedToken) {
4847
const decoded = client.parseAccessToken(storedToken.access_token);
4948
const validated = await client.validateAccessToken(storedToken.access_token);
5049
}
5150
```
5251

52+
When you pass a `sessionId` to `callback()`, the client stores the token under
53+
that key. If you omit it, the client falls back to the iRacing customer ID. If
54+
you already have a refresh token and want to force a refresh manually, call
55+
`client.refresh(refreshToken)`.
56+
5357
Pass any {@link SimpleStore} implementation as the state and session store to
5458
control how the client tracks authorization state and OAuth tokens. See
5559
`packages/oauth/client/src/storage/memory-store.ts` for a default in-memory

0 commit comments

Comments
 (0)