Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,7 @@ const proxyProvider = new ProxyOAuthServerProvider({
token,
clientId: "123",
scopes: ["openid", "email", "profile"],
expiresAt: Math.floor(Date.now() / 1000) + 3600
}
},
getClient: async (client_id) => {
Expand Down
6 changes: 5 additions & 1 deletion src/server/auth/middleware/bearerAuth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ describe("requireBearerAuth middleware", () => {
token: "no-expiration-token",
clientId: "client-123",
scopes: ["read", "write"],
expiresAt

// Type does not accept possible undefined so an assertion is required for this test
expiresAt: expiresAt as number
};
mockVerifyAccessToken.mockResolvedValue(noExpirationAuthInfo);

Expand Down Expand Up @@ -146,6 +148,7 @@ describe("requireBearerAuth middleware", () => {
token: "valid-token",
clientId: "client-123",
scopes: ["read"],
expiresAt: Math.floor(Date.now() / 1000) + 3600,
};
mockVerifyAccessToken.mockResolvedValue(authInfo);

Expand Down Expand Up @@ -418,6 +421,7 @@ describe("requireBearerAuth middleware", () => {
token: "valid-token",
clientId: "client-123",
scopes: ["read"],
expiresAt: Math.floor(Date.now() / 1000) + 3600,
};
mockVerifyAccessToken.mockResolvedValue(authInfo);

Expand Down
4 changes: 2 additions & 2 deletions src/server/auth/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface AuthInfo {
/**
* When the token expires (in seconds since epoch).
*/
expiresAt?: number;
expiresAt: number;

/**
* The RFC 8707 resource server identifier for which this token is valid.
Expand All @@ -33,4 +33,4 @@ export interface AuthInfo {
* This field should be used for any additional data that needs to be attached to the auth info.
*/
extra?: Record<string, unknown>;
}
}