We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7bd8398 commit 57ceb53Copy full SHA for 57ceb53
src/client/helpers/get-access-token.ts
@@ -1,6 +1,12 @@
1
import { AccessTokenError } from "../../errors";
2
3
-export async function getAccessToken() {
+type AccessTokenResponse = {
4
+ token: string;
5
+ scope?: string;
6
+ expires_at?: number;
7
+};
8
+
9
+export async function getAccessToken(): Promise<string> {
10
const tokenRes = await fetch(
11
process.env.NEXT_PUBLIC_ACCESS_TOKEN_ROUTE || "/auth/access-token"
12
);
@@ -23,6 +29,6 @@ export async function getAccessToken() {
23
29
24
30
}
25
31
26
- const tokenSet = await tokenRes.json();
32
+ const tokenSet: AccessTokenResponse = await tokenRes.json();
27
33
return tokenSet.token;
28
34
0 commit comments