MCPcopy
hub / github.com/upstash/context7 / isTokenExpired

Function isTokenExpired

packages/cli/src/utils/auth.ts:80–85  ·  view source on GitHub ↗
(tokens: TokenData)

Source from the content-addressed store, hash-verified

78}
79
80export function isTokenExpired(tokens: TokenData): boolean {
81 if (!tokens.expires_at) {
82 return false;
83 }
84 return Date.now() > tokens.expires_at - 60000;
85}
86
87async function refreshAccessToken(refreshToken: string): Promise<TokenData> {
88 const response = await fetch(`${getBaseUrl()}/api/oauth/token`, {

Callers 5

getValidAccessTokenFunction · 0.85
getAccessTokenFunction · 0.85
generateCommandFunction · 0.85
suggestCommandFunction · 0.85
auth-utils.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected