MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / createAuthToken

Function createAuthToken

api/src/utils/tokens.ts:51–58  ·  view source on GitHub ↗
(userId: string, ttl?: number)

Source from the content-addressed store, hash-verified

49 * @returns The access token.
50 */
51export const createAuthToken = (userId: string, ttl?: number): Token => {
52 return {
53 userId,
54 id: customNanoid(),
55 ttl: ttl ?? 900000,
56 created: new Date().toISOString()
57 };
58};
59
60/**
61 * Check if an access token has expired.

Callers 2

tokens.test.tsFile · 0.85
settingRoutesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected