(accessToken: string)
| 85 | } |
| 86 | |
| 87 | async function fetchGoogleUserInfo(accessToken: string): Promise<GoogleUserInfoResponse> { |
| 88 | const response = await fetch(GOOGLE_USERINFO_ENDPOINT, { |
| 89 | headers: { |
| 90 | Authorization: `Bearer ${accessToken}`, |
| 91 | }, |
| 92 | }); |
| 93 | |
| 94 | if (!response.ok) { |
| 95 | const errorText = await response.text(); |
| 96 | throw new Error(`Google userinfo request failed: ${errorText}`); |
| 97 | } |
| 98 | |
| 99 | return (await response.json()) as GoogleUserInfoResponse; |
| 100 | } |
| 101 | |
| 102 | export async function exchangeGoogleOAuthCode( |
| 103 | code: string, |
no test coverage detected