Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 42x 4x | import type { ServerApiContext } from "types/serverContext"; import { AuthorizationResponse } from "types/spotify"; import { CODE_VERIFIER_COOKIE, getSiteUrl, handleJsonResponse, takeCookie, } from "utils"; export async function getAuthorizationByCode( code: string, context?: ServerApiContext ): Promise<AuthorizationResponse | null> { const code_verifier = takeCookie(CODE_VERIFIER_COOKIE, context); const res = await fetch(`${getSiteUrl()}/api/spotify-login`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ code, code_verifier }), }); return handleJsonResponse<AuthorizationResponse>(res); } |